diff --git a/magnum_ui/karma.conf.js b/magnum_ui/karma.conf.js index 1a4543db..d4135433 100644 --- a/magnum_ui/karma.conf.js +++ b/magnum_ui/karma.conf.js @@ -16,10 +16,16 @@ var fs = require('fs'); var path = require('path'); +var child_process = require("child_process"); module.exports = function (config) { // This tox venv is setup in the post-install npm step - var toxPath = '../.tox/karma/lib/python3.5/site-packages/'; + var pythonVersion = "python3."; + var stdout = child_process.execFileSync("python3", ["--version"]); + pythonVersion += stdout.toString().split(".")[1]; + var toxPath = '../.tox/karma/lib/' + pythonVersion + '/site-packages/'; + console.log("Karma will check on directory: ", toxPath); + process.env.PHANTOMJS_BIN = 'node_modules/phantomjs-prebuilt/bin/phantomjs'; diff --git a/package.json b/package.json index 095c5cc5..a1426e1f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ }, "dependencies": {}, "scripts": { - "postinstall": "if [ ! -d .tox ] || [ ! -d .tox/karma ]; then tox -ekarma --notest; python3.5 -m pip install -U -t ./.tox/karma/lib/python3.5/site-packages/ ../horizon; fi", + "postinstall": "if [ ! -d .tox ] || [ ! -d .tox/karma ]; then tox -ekarma --notest; python3 -m pip install -U -t ./.tox/karma/lib/`python3 -V|tr -d ' '|tr 'P' 'p'|cut -c -9`/site-packages/ ../horizon; fi", "lint": "eslint --no-color magnum_ui/static", "lintq": "eslint --quiet magnum_ui/static", "test": "karma start magnum_ui/karma.conf.js --single-run" diff --git a/tox.ini b/tox.ini index 6fbbce5e..78a0340e 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ commands = commands = {posargs} [testenv:pep8] -basepython = python3.5 +basepython = python3 commands = flake8 {posargs} [flake8] @@ -36,6 +36,7 @@ exclude = .git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,lo max-complexity = 20 [testenv:cover] +basepython = python3 commands = coverage erase coverage run {toxinidir}/manage.py test magnum_ui --settings=magnum_ui.test.settings {posargs} --exclude-dir=magnum_ui/test/integration_tests {posargs} @@ -74,7 +75,7 @@ commands = {[testenv]commands} [testenv:eslint] -basepython = python3.5 +basepython = python3 whitelist_externals = npm commands = @@ -82,10 +83,10 @@ commands = npm run lint # NOTE(shu-mutow): The "postinstall" script on package.json will install horizon -# from master branch into karma environment with py35 for testing javascripts. +# from master branch into karma environment with python3.x for testing javascripts. # Horizon from master is needed to be cloned into ../horizon on both local and CI. [testenv:karma] -basepython = python3.5 +basepython = python3 whitelist_externals = {[testenv:eslint]whitelist_externals} commands = @@ -93,14 +94,14 @@ commands = npm run test [testenv:karma-local] -basepython = python3.5 +basepython = python3 whitelist_externals = {[testenv:eslint]whitelist_externals} commands = {[testenv:karma]commands} [testenv:docs] -basepython = python3.5 +basepython = python3 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/doc/requirements.txt @@ -108,7 +109,7 @@ commands= sphinx-build -W -b html doc/source doc/build/html [testenv:docs-local] -basepython = python3.5 +basepython = python3 deps = {[testenv:docs]deps} commands= @@ -116,7 +117,7 @@ commands= {[testenv:docs]commands} [testenv:releasenotes] -basepython = python3.5 +basepython = python3 deps = {[testenv:docs]deps} commands =