-
Notifications
You must be signed in to change notification settings - Fork 3
Initial implementation #1
Changes from all commits
6cb67fc
9a9a324
dd06d81
aa7c134
c19b0e4
6c1b897
6b87e0a
c71e96b
a838256
273232b
06d0cbb
fbc4ea4
06eacfc
deac8d0
bc15783
a67ccc1
918ed51
b574ec3
708b2cc
f19ab78
c3a098d
d2fe045
d2d0e84
224391a
602d021
9e6e001
dcf0840
792d4ba
d2a9f6e
0d4a06a
645115f
c03551d
461371b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
__pycache__/ | ||
*.py[cod] | ||
tests.integration.*.log | ||
tests.integration.*.png | ||
vectordraw_xblock.egg-info/ | ||
var/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: python | ||
python: | ||
- 2.7 | ||
before_install: | ||
- export DISPLAY=:99 | ||
- sh -e /etc/init.d/xvfb start | ||
install: | ||
- pip install -r test-requirements.txt | ||
- pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/base.txt | ||
- pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.txt | ||
- pip install -r $VIRTUAL_ENV/src/xblock/requirements.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems fragile, because the xblock and xblock-sdk repos don't expect their requirements to be installed like this. I would really like to understand why it's necessary to install these, and what the right way to install them is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nedbat Requirements files are flat. The transitive requirements of packages listed in An alternative would be to flatten the list of recursive requirements manually, and list all of them in Uploading all versions of our packages to PyPI comes with its own set of problems, too. I'm sure we could manage requirements in a better way than we currently do, but it isn't an easy problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nedbat Are you saying we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @smarnach @bradenmacdonald I don't have a specific proposal. I wanted to know why you needed to install xblock-sdk's test requirements. I would have thought they were only needed for testing the sdk, which you are not doing here. I understand about the difficulty of managing packages, and I'm sure part of this is us being sloppy in the xblock-sdk repo. I wanted to understand the problem so that we could decide on a way to fix it, wherever the best place is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nedbat Our integration tests on Travis CI use bok choy and selenium to run through the various XBlock views/handlers hosted within the XBlock SDK "workbench" runtime. That means that we need to install XBlock, XBlock SDK, bok choy, mock, ddt, etc. But if we specify those requirements in our own XBlock's requirements.txt (whether using pinned versions or not), we'll inevitably arrive at a situation where our XBlock requires a different version of some dependency than xblock-sdk does, which leads to inconsistent test results depending on environment and order of installation. And for people like me who have an "xblock venv" where I install xblock-sdk plus about 20 different XBlocks that I work on, version mismatches can be frustrating time sinks. So we've found that the easiest solution for now is just to say "we'll have what they're having" with respect to xblock-sdk, and standardize on whatever requirements it is using. |
||
script: | ||
- pep8 --max-line-length=100 vectordraw | ||
- pylint vectordraw | ||
- ./run_tests.py --with-coverage --cover-package=vectordraw | ||
notifications: | ||
email: false | ||
addons: | ||
firefox: 36.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[REPORTS] | ||
reports=no | ||
|
||
[FORMAT] | ||
max-line-length=100 | ||
|
||
[MESSAGES CONTROL] | ||
disable= | ||
I, | ||
attribute-defined-outside-init, | ||
maybe-no-member, | ||
star-args, | ||
too-few-public-methods, | ||
too-many-ancestors, | ||
too-many-instance-attributes, | ||
too-many-public-methods | ||
|
||
[VARIABLES] | ||
dummy-variables-rgx=_$|dummy|unused |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
git+https://github.com/edx/XBlock.git@xblock-0.4.2#egg=XBlock | ||
git+https://github.com/edx/xblock-utils.git@b4f9b51146c7fafa12f41d54af752b8f1516dffd#egg=xblock-utils | ||
-e . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file isn't necessary for the unit tests as well, but good to have for the integration tests. |
||
# -*- coding: utf-8 -*- | ||
"""Run tests for the Vector Drawing XBlock. | ||
|
||
This script is required to run our selenium tests inside the xblock-sdk workbench | ||
because the workbench SDK's settings file is not inside any python module. | ||
""" | ||
|
||
import os | ||
import logging | ||
import sys | ||
|
||
from django.conf import settings | ||
from django.core.management import execute_from_command_line | ||
|
||
logging_level_overrides = { | ||
'workbench.views': logging.ERROR, | ||
'django.request': logging.ERROR, | ||
'workbench.runtime': logging.ERROR, | ||
} | ||
|
||
if __name__ == '__main__': | ||
# Use the workbench settings file: | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'workbench.settings') | ||
# Configure a range of ports in case the default port of 8081 is in use | ||
os.environ.setdefault('DJANGO_LIVE_TEST_SERVER_ADDRESS', 'localhost:8081-8099') | ||
|
||
try: | ||
os.mkdir('var') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you making this directory? What is it used for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @singingwolfboy The workbench uses the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should fix this in the workbench eventually. It's kind of stupid that workbench simply errors out if the directory doesn't exist, so all XBlocks have to create it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please write issues for things like this. I've done this one: https://github.com/edx/xblock-sdk/issues/99 |
||
except OSError: | ||
# May already exist. | ||
pass | ||
|
||
settings.INSTALLED_APPS += ('vectordraw', ) | ||
|
||
for noisy_logger, log_level in logging_level_overrides.iteritems(): | ||
logging.getLogger(noisy_logger).setLevel(log_level) | ||
|
||
args_iter = iter(sys.argv[1:]) | ||
options = [] | ||
paths = [] | ||
for arg in args_iter: | ||
if arg == '--': | ||
break | ||
if arg.startswith('-'): | ||
options.append(arg) | ||
else: | ||
paths.append(arg) | ||
paths.extend(args_iter) | ||
if not paths: | ||
paths = ['tests/'] | ||
execute_from_command_line([sys.argv[0], 'test'] + options + ['--'] + paths) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Setup for vectordraw XBlock.""" | ||
|
||
import os | ||
from setuptools import setup | ||
|
||
|
||
def package_data(pkg, roots): | ||
"""Generic function to find package_data. | ||
|
||
All of the files under each of the `roots` will be declared as package | ||
data for package `pkg`. | ||
|
||
""" | ||
data = [] | ||
for root in roots: | ||
for dirname, _, files in os.walk(os.path.join(pkg, root)): | ||
for fname in files: | ||
data.append(os.path.relpath(os.path.join(dirname, fname), pkg)) | ||
|
||
return {pkg: data} | ||
|
||
|
||
setup( | ||
name='vectordraw-xblock', | ||
version='0.1', | ||
description='vectordraw XBlock', # TODO: write a better description. | ||
packages=[ | ||
'vectordraw', | ||
], | ||
install_requires=[ | ||
'XBlock', | ||
'xblock-utils', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @singingwolfboy Thanks for catching that. The Vector Drawing XBlock itself actually doesn't make use of |
||
], | ||
entry_points={ | ||
'xblock.v1': [ | ||
'vectordraw = vectordraw:VectorDrawXBlock', | ||
] | ||
}, | ||
package_data=package_data("vectordraw", ["static", "public"]), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Django>=1.8, <1.9 | ||
-r requirements.txt | ||
-e git+https://github.com/edx/xblock-sdk.git@8eb5f174dc59c0f4e40e10eaab56753958651d17#egg=xblock-sdk | ||
ddt | ||
selenium==2.47.3 # 2.48 is not working atm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really used yet, since there aren't any integration tests. We can leave this here, since we will have to add integration tests anyway. They will be a bit tricky to implement, but it won't be too bad.