From 2cdecf901c687e9aff9305822d7d94830272501b Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Fri, 13 Dec 2019 16:47:38 -0500 Subject: [PATCH] add check to ensure versions match Comments state that the python and npm version should match. However, comments are easy to miss. Adds a script to check. --- .travis.yml | 6 ++++++ edx_proctoring/scripts/version_check.py | 16 ++++++++++++++++ tox.ini | 9 ++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 edx_proctoring/scripts/version_check.py diff --git a/.travis.yml b/.travis.yml index bbba64ed31e..368aa4d3ef6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/edx_proctoring/scripts/version_check.py b/edx_proctoring/scripts/version_check.py new file mode 100755 index 00000000000..f976c6355b7 --- /dev/null +++ b/edx_proctoring/scripts/version_check.py @@ -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!") diff --git a/tox.ini b/tox.ini index c13adcf5af7..416ae4abfb5 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = py36-django111-drflatest, docs, quality, + version_check, pii_check, translations @@ -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 = @@ -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