diff --git a/.travis.yml b/.travis.yml index 7432f2fa0d0..737615c8b38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,21 +3,24 @@ cache: pip python: - 2.7 env: -- DJANGO_SETTINGS_MODULE=test_settings +- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drf37 +- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drf38 +- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drf39 +- DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drflatest +- DJANGO_SETTINGS_MODULE=test_setting TOXENV=quality +- TOXENV=js +- TOXENV=translations before_install: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start -- pip install --upgrade pip install: -- pip install setuptools>=32.3.1 # need newer version than Travis default -- make install +- pip install tox-travis +- pip install -r requirements/test.txt +- npm install before_script: - npm install -g gulp-cli script: -- make validate_translations -- make test-all -- make test-js -- make lint-js +- tox after_success: - coverage xml - bash <(curl -s https://codecov.io/bash) -cF python -f coverage.xml @@ -28,6 +31,7 @@ deploy: distributions: sdist bdist_wheel on: tags: true + condition: '$TOXENV=quality' password: secure: Xx0ya0JKOzPEX5fL389UQxiSnu46D/tVWwdgKXGT+g9GceQsxUWyshqC8uPF1KgKQfMynmC4C/XQOktfQj4LEv2EQPfnYP7Aog+swxS23jHevQYC7H0mlc5pyzTqfGbb5nr1gVtq2pjfsvC2RSgrZGigpCympyD1qKb6HBb3xcCpaUpLBMJFO+uUCIKYe6zJ0zxykW1Z66qE7igNyfvDqMbB/Sn6VO9PBrQOnTNnl4JyLer6gN+nztJTvpgwcKT7jUjtJtBDoTqj9ia/jJLGhAYNppCdLwmjNU1aN+e6X7J0HXBizOgqL7skWYAR1ygXwv027ZC3LJjiC6Ovww0rRzJdWe/OMJu5RzTYvXjgyBdjMdk3lYw5LaNoRuLfWkntV8ORYULsjl/g1RUJrXQ5u1KxeVPM9Fwb5toH1OmAMbuTpAmbYK8itWdU0TGiDsgLQABeNeW57DQIqE04YVG+kK1zg3OV7W6CgEVKXWciOugWJSdTtyoI5RBOuW1altKapee2/xwd49X5F5eac1AKsRc3U5DNxc0DCLR3NRmrHVBOD+yfI0F42MwngK9tbevDyZ9t1tf04ysu6hvzwES5goVp+85hHIyf+NIiKQpQQbKYWwIGcQuGlo7vHyOs9LJ5qHXQSzFZu8+l9qn3cCEd/cY7geh15yKOSVzv0J7yb84= - provider: npm @@ -36,3 +40,4 @@ deploy: secure: Bs6z6iFpO86mav8qo3cDhcjDckNXDGfcbuZtSWbbrIFe9Q0VSVz046s9Yo7hHjjaRUSb6frlTC8lYRNDZ2m7TxXrh4vXHrHsr9ajcJXUZJCwqnnxIEFeHe02hD/7RPJ3xK7tkGCxd/2AUHEHXYylGOePDc/Ck/2VYmGQ0EijcfZeOJ5macZ65TP0Kwvf+IDOko++W94f3Ujglu+lWryBTR61Yaf7zt7fKQVgjxGQjb07F1ze39A00xkYYYbIDSrzjZeebs/pzCjZhrrkzTwReDItTxk9K7cEx5nlRvQul6Wj5USe1uBL5SodP2XCp3mi7XrB/LOt6kDEcdREUzqZUqB5n21VVey0JWihd579PIHFhTXDQpdSJNhOi86Mv8lj3v/XUTRaZBV+2OPVGKSRgmJ0Qv7BkQXOp8tzSN4AINrYD2bMod3jVaGcjg7MYUpJ7B2swWUSa0aLLUe1M2RYzfQ2CiGeN9jCdz8jmQie+HGc5CkaMFtoT1OUt1R7wuO2RNo8pYrP0KJTWpOCHlGn+5r17iDOPXoc/m6a5wN3sxMrARqF5A/PRv3uY/Nb+4bfTeczDZudpxVxGFxe85rahXjh7tSHX5JOiaOXDO9xWj2EBRKKeD4xbgRSBZvjnRrZ0f9ygZjuzFv86KixwYI3HFo21SJQmIaJIUSOoM+r1lQ= on: tags: true + condition: '$TOXENV=quality' diff --git a/Makefile b/Makefile index 96abc977048..8405b490542 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,10 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy pip-compile --upgrade -o requirements/doc.txt requirements/doc.in pip-compile --upgrade -o requirements/quality.txt requirements/quality.in pip-compile --upgrade -o requirements/test.txt requirements/test.in - # Let tox control the Django version for tests - sed '/^django==/d' requirements/test.txt > requirements/test.tmp - mv requirements/test.tmp requirements/test.txt + # Let tox control the Django and djangorestframework versions for tests + sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt + sed -i.tmp '/^djangorestframework==/d' requirements/test.txt + rm requirements/test.txt.tmp requirements: ## install development environment requirements pip install -qr requirements/dev.txt --exists-action w diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index a91e8513f54..6ca91c92502 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -5,6 +5,6 @@ from __future__ import absolute_import # Be sure to update the version number in edx_proctoring/package.json -__version__ = '1.7.1' +__version__ = '2.0.0' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/tests/test_serializer.py b/edx_proctoring/tests/test_serializer.py index aa51d32d961..d5667b2c631 100644 --- a/edx_proctoring/tests/test_serializer.py +++ b/edx_proctoring/tests/test_serializer.py @@ -32,9 +32,5 @@ def test_boolean_fields(self): serializer = ProctoredExamSerializer(data=data) self.assertFalse(serializer.is_valid()) - self.assertDictEqual( - { - 'is_proctored': [u'"bla" is not a valid boolean.'], - 'is_practice_exam': [u'"bla" is not a valid boolean.'], - }, serializer.errors - ) + self.assertIn('is_proctored', serializer.errors) + self.assertIn('is_practice_exam', serializer.errors) diff --git a/edx_proctoring/views.py b/edx_proctoring/views.py index 38de6134c19..49ea03ca225 100644 --- a/edx_proctoring/views.py +++ b/edx_proctoring/views.py @@ -425,10 +425,10 @@ def put(self, request, attempt_id): ) else: exam_attempt_id = False - LOG.warn(u'Browser JS reported problem with proctoring desktop ' - u'application. Did block user: %s, for attempt: %s', - should_block_user, - attempt['id']) + LOG.warning(u'Browser JS reported problem with proctoring desktop ' + u'application. Did block user: %s, for attempt: %s', + should_block_user, + attempt['id']) elif action == 'decline': exam_attempt_id = update_attempt_status( attempt['proctored_exam']['id'], diff --git a/package.json b/package.json index d400c933e38..06d2c323ce7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@edx/edx-proctoring", "//": "Be sure to update the version number in edx_proctoring/__init__.py", "//": "Note that the version format is slightly different than that of the Python version when using prereleases.", - "version": "1.7.1", + "version": "2.0.0", "main": "edx_proctoring/static/index.js", "repository": { "type": "git", diff --git a/requirements/base.in b/requirements/base.in index 7022c39fb4a..f365a83b1f5 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,9 +1,10 @@ # Core requirements for using this application +-c constraints.txt # Django/Framework Packages django<2,>=1.11 django-model-utils>=2.3.1 -djangorestframework>=3.1,<3.7 +djangorestframework django-ipware>=1.1.0 jsonfield>=2.0.2 pytz>=2018 diff --git a/requirements/base.txt b/requirements/base.txt index 26c1c863290..f22be05e959 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,7 +5,6 @@ # pip-compile --upgrade -o requirements/base.txt requirements/base.in # appdirs==1.4.3 # via fs -backports.os==0.1.1 # via fs certifi==2019.3.9 # via requests chardet==3.0.4 # via requests django-crum==0.7.3 @@ -15,16 +14,15 @@ django-waffle==0.16.0 django-webpack-loader==0.6.0 django==1.11.20 djangorestframework-jwt==1.11.0 # via edx-drf-extensions -djangorestframework==3.6.4 +djangorestframework==3.9.3 edx-django-utils==1.0.3 # via edx-drf-extensions edx-drf-extensions==2.2.0 edx-opaque-keys==0.4.4 edx-rest-api-client==1.9.2 edx-when==0.1.3 -enum34==1.1.6 # via fs event-tracking==0.2.8 fs==2.4.4 # via xblock -future==0.17.1 # via backports.os, pyjwkest +future==0.17.1 # via pyjwkest idna==2.8 # via requests jsonfield==2.0.2 lxml==4.3.3 # via xblock @@ -46,7 +44,6 @@ semantic-version==2.6.0 # via edx-drf-extensions six==1.12.0 # via edx-drf-extensions, edx-opaque-keys, event-tracking, fs, pyjwkest, python-dateutil, stevedore, xblock slumber==0.7.1 # via edx-rest-api-client stevedore==1.30.1 # via edx-opaque-keys -typing==3.6.6 # via fs urllib3==1.24.2 # via requests web-fragments==0.3.0 # via xblock webob==1.8.5 # via xblock diff --git a/requirements/constraints.txt b/requirements/constraints.txt new file mode 100644 index 00000000000..660a96278e1 --- /dev/null +++ b/requirements/constraints.txt @@ -0,0 +1,19 @@ +# Version constraints for pip installation. +# +# This file doesn't install any packages. It specifies version constraints +# that will be applied if a package is needed. +# +# When pinning something here, please provide an explanation of why. Ideally, +# link to other information that will help people in the future to remove the +# pin when possible. Writing an issue against the offending project and +# linking to it here is good. + +# Sphinx 2.0.0 drops support for python 2.7 which we still need. +Sphinx<2.0.0 + + +# A dependency of pytest. Pytest doesn't constrain it and 6.0.0 onward +# only works with python 3 +more-itertools<6.0.0 + +path.py<12.0 # path.py 12.0 drops support for python 2.7 diff --git a/requirements/dev.in b/requirements/dev.in index 23dc8a99dcd..5468627079a 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,4 +1,5 @@ # Additional requirements for development of this application +-c constraints.txt -r quality.in @@ -10,5 +11,5 @@ tox # virtualenv management for tests tox-battery # Makes tox aware of requirements file changes twine # Utility for PyPI package uploads wheel # For generation of wheels for PyPI -path.py==11.5.0 # pinned because of python 3 incompatibility +path.py django>=1.11,<2.0 diff --git a/requirements/dev.txt b/requirements/dev.txt index edf133b6796..57b9cdd378b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -6,26 +6,21 @@ # argparse==1.4.0 # via caniusepython3 astroid==1.5.2 # via edx-lint, pylint, pylint-celery -backports.functools-lru-cache==1.5 # via astroid, caniusepython3, isort, pylint +backports.functools-lru-cache==1.5 # via caniusepython3 bleach==3.1.0 # via readme-renderer caniusepython3==7.0.0 certifi==2019.3.9 # via requests chardet==3.0.4 # via requests click-log==0.1.8 # via edx-lint click==7.0 # via click-log, edx-lint, pip-tools -configparser==3.7.4 # via importlib-metadata, pydocstyle, pylint -contextlib2==0.5.5 # via importlib-metadata diff-cover==2.0.0 distlib==0.2.8 # via caniusepython3 django==1.11.20 docutils==0.14 # via readme-renderer edx-i18n-tools==0.4.8 edx_lint==0.5.5 -enum34==1.1.6 # via astroid filelock==3.0.10 # via tox -futures==3.2.0 # via caniusepython3, isort idna==2.8 # via requests -importlib-metadata==0.9 # via path.py inflect==2.1.0 # via jinja2-pluralize isort==4.3.17 jinja2-pluralize==0.3.0 # via diff-cover @@ -34,8 +29,7 @@ lazy-object-proxy==1.3.1 # via astroid markupsafe==1.1.1 # via jinja2 mccabe==0.6.1 # via pylint packaging==19.0 # via caniusepython3 -path.py==11.5.0 -pathlib2==2.3.3 # via importlib-metadata +path.py==11.5.2 pip-tools==3.6.1 pkginfo==1.5.0.1 # via twine pluggy==0.9.0 # via tox @@ -54,9 +48,7 @@ pyyaml==5.1 # via edx-i18n-tools readme-renderer==24.0 # via twine requests-toolbelt==0.9.1 # via twine requests==2.21.0 # via caniusepython3, requests-toolbelt, twine -scandir==1.10.0 # via pathlib2 -singledispatch==3.4.0.3 # via astroid, pylint -six==1.12.0 # via astroid, bleach, diff-cover, edx-i18n-tools, edx-lint, packaging, pathlib2, pip-tools, pydocstyle, pylint, readme-renderer, singledispatch, tox +six==1.12.0 # via astroid, bleach, diff-cover, edx-i18n-tools, edx-lint, packaging, pip-tools, pydocstyle, pylint, readme-renderer, tox snowballstemmer==1.2.1 # via pydocstyle toml==0.10.0 # via tox tox-battery==0.5.1 @@ -68,4 +60,3 @@ virtualenv==16.5.0 # via tox webencodings==0.5.1 # via bleach wheel==0.33.1 wrapt==1.11.1 # via astroid -zipp==0.4.0 # via importlib-metadata diff --git a/requirements/doc.in b/requirements/doc.in index 81042dfb713..46d19216583 100644 --- a/requirements/doc.in +++ b/requirements/doc.in @@ -1,4 +1,5 @@ # Requirements for documentation validation +-c constraints.txt -r base.in diff --git a/requirements/doc.txt b/requirements/doc.txt index 175cf48365d..af19809c520 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -7,7 +7,6 @@ alabaster==0.7.12 # via sphinx appdirs==1.4.3 # via fs babel==2.6.0 # via sphinx -backports.os==0.1.1 # via fs bleach==3.1.0 # via readme-renderer certifi==2019.3.9 # via requests chardet==3.0.4 # via doc8, requests @@ -18,7 +17,7 @@ django-waffle==0.16.0 django-webpack-loader==0.6.0 django==1.11.20 djangorestframework-jwt==1.11.0 # via edx-drf-extensions -djangorestframework==3.6.4 +djangorestframework==3.9.3 doc8==0.8.0 docutils==0.14 # via doc8, readme-renderer, restructuredtext-lint, sphinx edx-django-utils==1.0.3 # via edx-drf-extensions @@ -27,10 +26,9 @@ edx-opaque-keys==0.4.4 edx-rest-api-client==1.9.2 edx-sphinx-theme==1.4.0 edx-when==0.1.3 -enum34==1.1.6 # via fs event-tracking==0.2.8 fs==2.4.4 # via xblock -future==0.17.1 # via backports.os, pyjwkest +future==0.17.1 # via pyjwkest idna==2.8 # via requests imagesize==1.1.0 # via sphinx jinja2==2.10.1 # via sphinx @@ -64,7 +62,6 @@ sphinx==1.8.5 sphinxcontrib-napoleon==0.7 sphinxcontrib-websupport==1.1.0 # via sphinx stevedore==1.30.1 # via doc8, edx-opaque-keys -typing==3.6.6 # via fs, sphinx urllib3==1.24.2 # via requests web-fragments==0.3.0 # via xblock webencodings==0.5.1 # via bleach diff --git a/requirements/quality.in b/requirements/quality.in index 77695d37827..697d9d72764 100644 --- a/requirements/quality.in +++ b/requirements/quality.in @@ -1,8 +1,9 @@ # Requirements for code quality checks +-c constraints.txt caniusepython3 # Additional Python 3 compatibility pylint checks edx_lint==0.5.5 # Python code linting rules isort # to standardize order of imports pycodestyle # PEP 8 compliance validation pydocstyle # PEP 257 compliance validation -django<2.0 \ No newline at end of file +django<2.0 diff --git a/requirements/quality.txt b/requirements/quality.txt index 5e643b285cf..9430b3e022d 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -6,18 +6,15 @@ # argparse==1.4.0 # via caniusepython3 astroid==1.5.2 # via edx-lint, pylint, pylint-celery -backports.functools-lru-cache==1.5 # via astroid, caniusepython3, isort, pylint +backports.functools-lru-cache==1.5 # via caniusepython3 caniusepython3==7.0.0 certifi==2019.3.9 # via requests chardet==3.0.4 # via requests click-log==0.1.8 # via edx-lint click==7.0 # via click-log, edx-lint -configparser==3.7.4 # via pydocstyle, pylint distlib==0.2.8 # via caniusepython3 django==1.11.20 edx_lint==0.5.5 -enum34==1.1.6 # via astroid -futures==3.2.0 # via caniusepython3, isort idna==2.8 # via requests isort==4.3.17 lazy-object-proxy==1.3.1 # via astroid @@ -32,8 +29,7 @@ pylint==1.7.1 # via edx-lint, pylint-celery, pylint-django, pylint-p pyparsing==2.4.0 # via packaging pytz==2019.1 # via django requests==2.21.0 # via caniusepython3 -singledispatch==3.4.0.3 # via astroid, pylint -six==1.12.0 # via astroid, edx-lint, packaging, pydocstyle, pylint, singledispatch +six==1.12.0 # via astroid, edx-lint, packaging, pydocstyle, pylint snowballstemmer==1.2.1 # via pydocstyle urllib3==1.24.2 # via requests wrapt==1.11.1 # via astroid diff --git a/requirements/test.in b/requirements/test.in index 2496652bbf0..93ce3ca2f13 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -1,11 +1,14 @@ # Requirements for test runs. +-c constraints.txt -r base.in +edx-i18n-tools # be able to run `make validate_translations` pytest-cov # pytest extension for code coverage statistics pytest-django # pytest extension for better Django support pytest-xdist # pytest extension for parallel execution + bok-choy>=0.3.1 ddt>=0.8.0 freezegun>=0.3.1 diff --git a/requirements/test.txt b/requirements/test.txt index 255d1478135..ea766116797 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -8,11 +8,9 @@ apipkg==1.5 # via execnet appdirs==1.4.3 # via fs atomicwrites==1.3.0 # via pytest attrs==19.1.0 # via pytest -backports.os==0.1.1 # via fs bok-choy==1.0.0 certifi==2019.3.9 # via requests chardet==3.0.4 # via requests -cookies==2.2.1 # via responses coverage==4.5.3 # via pytest-cov ddt==1.2.1 django-crum==0.7.3 @@ -21,19 +19,17 @@ django-model-utils==3.1.2 django-waffle==0.16.0 django-webpack-loader==0.6.0 djangorestframework-jwt==1.11.0 # via edx-drf-extensions -djangorestframework==3.6.4 edx-django-utils==1.0.3 # via edx-drf-extensions edx-drf-extensions==2.2.0 +edx-i18n-tools==0.4.8 edx-opaque-keys==0.4.4 edx-rest-api-client==1.9.2 edx-when==0.1.3 -enum34==1.1.6 # via fs event-tracking==0.2.8 execnet==1.6.0 # via pytest-xdist freezegun==0.3.11 fs==2.4.4 # via xblock -funcsigs==1.0.2 # via mock, pytest -future==0.17.1 # via backports.os, pyjwkest +future==0.17.1 # via pyjwkest httmock==1.3.0 httpretty==0.9.6 idna==2.8 # via requests @@ -45,9 +41,10 @@ markupsafe==1.1.1 # via xblock mock==2.0.0 more-itertools==5.0.0 # via pytest newrelic==4.18.0.118 # via edx-django-utils -pathlib2==2.3.3 # via pytest, pytest-django +path.py==11.5.2 # via edx-i18n-tools pbr==5.2.0 # via mock, stevedore pluggy==0.9.0 # via pytest +polib==1.1.0 # via edx-i18n-tools psutil==1.2.1 # via edx-django-utils, edx-drf-extensions py==1.8.0 # via pytest pycryptodomex==3.8.1 @@ -61,20 +58,18 @@ pytest-xdist==1.28.0 pytest==4.4.1 # via pytest-cov, pytest-django, pytest-forked, pytest-xdist python-dateutil==2.8.0 pytz==2019.1 -pyyaml==5.1 # via xblock +pyyaml==5.1 # via edx-i18n-tools, xblock requests==2.21.0 # via edx-drf-extensions, edx-rest-api-client, httmock, pyjwkest, responses, slumber responses==0.10.6 rest-condition==1.0.3 # via edx-drf-extensions rules==2.0.1 -scandir==1.10.0 # via pathlib2 selenium==3.141.0 semantic-version==2.6.0 # via edx-drf-extensions -six==1.12.0 # via bok-choy, edx-drf-extensions, edx-opaque-keys, event-tracking, freezegun, fs, httpretty, logilab-common, mock, more-itertools, pathlib2, pyjwkest, pytest, pytest-xdist, python-dateutil, responses, stevedore, xblock +six==1.12.0 # via bok-choy, edx-drf-extensions, edx-i18n-tools, edx-opaque-keys, event-tracking, freezegun, fs, httpretty, logilab-common, mock, more-itertools, pyjwkest, pytest, pytest-xdist, python-dateutil, responses, stevedore, xblock slumber==0.7.1 # via edx-rest-api-client stevedore==1.30.1 # via edx-opaque-keys sure==1.2.7 testfixtures==6.7.1 -typing==3.6.6 # via fs urllib3==1.24.2 # via requests, selenium web-fragments==0.3.0 # via xblock webob==1.8.5 # via xblock diff --git a/setup.py b/setup.py index a8ee18e1ca3..01344a85aa5 100755 --- a/setup.py +++ b/setup.py @@ -54,13 +54,7 @@ def is_requirement(line): Return True if the requirement line is a package requirement; that is, it is not blank, a comment, a URL, or an included file. """ - return not ( - line == '' or - line.startswith('-r') or - line.startswith('#') or - line.startswith('-e') or - line.startswith('git+') - ) + return not (line == '' or line.startswith(('-r', '#', '-e', 'git+', '-c'))) setup( diff --git a/tox.ini b/tox.ini index 1945e5ce3f1..fb926f2c498 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27}-django{111} +envlist = {py27}-django{111}-drf{37,38,39,latest} [doc8] max-line-length = 120 @@ -19,6 +19,10 @@ match-dir = (?!migrations) [testenv] deps = django111: Django>=1.11,<2.0 + drf37: djangorestframework<3.8.0 + drf38: djangorestframework<3.9.0 + drf39: djangorestframework<4.0.0 + drflatest: djangorestframework -rrequirements/test.txt commands = py.test -rfe --cov=edx_proctoring --cov-report=html --ds=test_settings -n 3 {posargs} @@ -52,6 +56,22 @@ commands = pylint edx_proctoring pycodestyle edx_proctoring +[testenv:translations] +whitelist_externals = + make +deps = + -rrequirements/test.txt +commands = + make validate_translations + +[testenv:js] +whitelist_externals = + make + +commands = + make test-js + make lint-js + [pytest] filterwarnings = ignore::DeprecationWarning:responses