From 9bdf6593e591b91dad6bd0349f7581c3169ef8e2 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 1 Mar 2016 11:17:11 -0500 Subject: [PATCH] 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 --- tox.ini | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index b79588f287..da58ec017b 100644 --- a/tox.ini +++ b/tox.ini @@ -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