diff --git a/karma.conf.js b/karma.conf.js index 559aa35..cd34e59 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -20,7 +20,16 @@ var path = require('path'); module.exports = function (config) { // This tox venv is setup in the post-install npm step - var toxPath = '.tox/py38/lib/python3.8/site-packages/'; + var toxPath = path.resolve('./.tox/npm'); + if (!toxPath) { + console.error('xStatic libraries not found, please run `tox -e npm`'); + process.exit(1); + } + toxPath += '/lib/'; + toxPath += fs.readdirSync(toxPath).find(function(directory) { + return directory.indexOf('python') === 0; + }); + toxPath += '/site-packages/'; var xstaticPath = toxPath + 'xstatic/pkg/'; config.set({ diff --git a/package.json b/package.json index a7e5c43..3565920 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "karma-ng-html2js-preprocessor": "1.0.0" }, "scripts": { - "postinstall": "if [ ! -d .tox/py38 ]; then tox -epy38 --notest; fi", + "postinstall": "if [ ! -d .tox/npm ]; then tox -e npm --notest; fi", "lint": "eslint --no-color designatedashboard/static", "lintq": "eslint --quiet designatedashboard/static", "test": "karma start karma.conf.js --single-run" diff --git a/tox.ini b/tox.ini index b872a90..0a758cd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.18.0 -envlist = py3,pep8 +envlist = py3,pep8, npm skipsdist = True # Automatic envs (pyXX) will only use the python version appropriate to that # env and ignore basepython inherited from [testenv] if we set @@ -19,6 +19,8 @@ setenv = VIRTUAL_ENV={envdir} PYTHONDONTWRITEBYTECODE=1 DJANGO_SETTINGS_MODULE=designatedashboard.settings allowlist_externals = find + {toxinidir}/manage.py + npm deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt @@ -26,7 +28,13 @@ deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/up commands = find . -type f -name "*.pyc" -delete {toxinidir}/manage.py test designatedashboard --settings=designatedashboard.tests.settings -passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY +passenv = + http_proxy + HTTP_PROXY + https_proxy + HTTPS_PROXY + no_proxy + NO_PROXY [testenv:pep8] commands = flake8