remove pyc files before running tests

pyc files for old code files and test files won't get removed from the
local tree when those files are removed. They will still be discovered
and used when running tox tests.

This removes pyc files before running tests to ensure that test
results are repeatble by end users even if they are updating older git
trees.

Closes-Bug: #1551312

Change-Id: I9987cc57dc9ac2bd0331af6cb59e2c5e137d9849
This commit is contained in:
Sean Dague 2016-03-01 11:17:11 -05:00 committed by Steve Martinelli
parent f39ac2e8a8
commit 9bdf6593e5

21
tox.ini
View File

@ -9,12 +9,16 @@ install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
.[ldap,memcache,mongodb]
commands = bash tools/pretty_tox.sh '{posargs}'
commands =
find keystone -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '{posargs}'
whitelist_externals = bash
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY PBR_VERSION
[testenv:py34]
commands = bash tools/pretty_tox_py3.sh
commands =
find keystone -type f -name "*.pyc" -delete
bash tools/pretty_tox_py3.sh
[testenv:legacy_drivers]
deps = -r{toxinidir}/test-requirements.txt
@ -22,6 +26,7 @@ deps = -r{toxinidir}/test-requirements.txt
.[ldap,memcache,mongodb]
commands =
# Run each legacy test separately, to avoid SQL model redefinitions
find keystone -type f -name "*.pyc" -delete
nosetests -v \
keystone/tests/unit/backend/legacy_drivers/assignment/V8/sql.py
nosetests -v \
@ -53,13 +58,17 @@ deps = .[bandit]
commands = bandit -r keystone
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
commands =
find keystone -type f -name "*.pyc" -delete
python setup.py testr --coverage --testr-args='{posargs}'
[testenv:venv]
commands = {posargs}
[testenv:debug]
commands = oslo_debug_helper {posargs}
commands =
find keystone -type f -name "*.pyc" -delete
oslo_debug_helper {posargs}
passenv =
KSTEST_ADMIN_URL
KSTEST_ADMIN_USERNAME
@ -75,7 +84,9 @@ passenv =
basepython = python3.4
deps = -r{toxinidir}/test-requirements.txt
setenv = OS_TEST_PATH=./keystone/tests/functional
commands = python setup.py testr --slowest --testr-args='{posargs}'
commands =
find keystone -type f -name "*.pyc" -delete
python setup.py testr --slowest --testr-args='{posargs}'
passenv =
KSTEST_ADMIN_URL
KSTEST_ADMIN_USERNAME