Remove hard-coded Python path in karma.conf.js

This patch removes hard-coded Python path in karma.conf.js
to fix the npm jobs because now these npm jobs run on
debian-bullseye and py38 are not available there.

Change-Id: I7474bfc60f503ab5b4a278e0f835cc088ec911a7
This commit is contained in:
manchandavishal 2022-12-06 18:03:50 +05:30 committed by Michael Johnson
parent eea2417850
commit b89a1e5177
3 changed files with 21 additions and 4 deletions

View File

@ -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({

View File

@ -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"

12
tox.ini
View File

@ -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