tox: Don't delete Python3 .pyc files

Python3 is smarter than Python2 about when to make use of .pyc files, so
there's no need to remove them before running unit tests just in case the
developer has switched branches.[1] To save recompiling before every test
run, disable this behaviour for Python3.

Also, use a consistent find command in all of the environments where we do
this.

[1] https://www.python.org/dev/peps/pep-3147/#case-3-pycache-foo-magic-pyc-with-no-source

Change-Id: Iabaa4a697329e7538fab93541f41fc208e591382
This commit is contained in:
Zane Bitter 2018-03-28 21:36:37 -04:00
parent bee5617b41
commit 8f76a10cae
1 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
stestr run '{posargs}'
stestr slowest
@ -23,7 +23,7 @@ passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:py27log]
commands =
find . -type f -name "*.py[c|o]" -delete
find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
stestr run '^(?!heat_integrationtests){posargs}'
[testenv:pep8]
@ -53,7 +53,7 @@ setenv =
PYTHON=coverage run --source heat --parallel-mode
commands =
coverage erase
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
find {toxinidir} -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
stestr run '{posargs}'
coverage combine
coverage html -d cover