Skip to content

Commit

Permalink
add check to ensure versions match
Browse files Browse the repository at this point in the history
Comments state that the python and npm version should match. However,
comments are easy to miss. Adds a script to check.
  • Loading branch information
robrap committed Dec 13, 2019
1 parent ea82346 commit 2cdecf9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ env:
# - DJANGO_SETTINGS_MODULE=test_setting TOXENV=django111-drflatest
- DJANGO_SETTINGS_MODULE=test_setting TOXENV=quality
- DJANGO_SETTINGS_MODULE=test_setting TOXENV=pii_check
- TOXENV=version_check
- TOXENV=translations

matrix:
exclude:
- python: 2.7
env: TOXENV=version_check

before_install:
- export DISPLAY=:99.0

Expand Down
16 changes: 16 additions & 0 deletions edx_proctoring/scripts/version_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
"""
Scripts to ensure that the Python and npm versions match.
"""
import json
import sys
from edx_proctoring import __version__ as python_version

with open('package.json') as json_file:
data = json.load(json_file)
if data['version'] != python_version:
print("\n\n\n")
print("ERROR: Version mismatch. Please update version in edx_proctoring/__init__.py or edx_proctoring/package.json.\n") # noqa E501 line too long
sys.exit(1)
else:
print("Version check success!")
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist =
py36-django111-drflatest,
docs,
quality,
version_check,
pii_check,
translations

Expand All @@ -16,7 +17,7 @@ deps =
drflatest: djangorestframework
-rrequirements/test.txt
commands =
py.test -rfe --cov=edx_proctoring --cov-report=html --ds=test_settings -n 3 {posargs}
py.test -rfe --cov=edx_proctoring --cov-report=html --ds=test_settings {posargs:-n 3}

[testenv:docs]
setenv =
Expand Down Expand Up @@ -48,6 +49,12 @@ commands =
pylint edx_proctoring
pycodestyle edx_proctoring

[testenv:version_check]
deps =
-r{toxinidir}/requirements/base.txt
commands =
{toxinidir}/edx_proctoring/scripts/version_check.py

[testenv:pii_check]
whitelist_externals =
make
Expand Down

0 comments on commit 2cdecf9

Please sign in to comment.