tox: Don't create '.pyc' files

There's no reason to create these files and cleaning them up takes
precious time during each test run. Don't do it.

The benefits of this can be seen in running both the full test suite
and part of the test suite. For the former case - running the full
test suite:

    $ time ( tox -e py27 )

Without this change:

    real    12m48.003s
    user    38m27.039s
    sys     1m2.786s

With this change:

    real    11m53.921s
    user    39m33.360s
    sys     1m1.686s

For the latter case - running part of the full test suite:

    $ time ( tox -e py27 -- nova.tests.unit.test_configdrive2 )

Without this change:

    real    2m0.686s
    user    1m3.080s
    sys     0m12.950s

With this change:

    real    1m37.098s
    user    1m16.559s
    sys     0m11.846s

The actual results can vary massively, but this change is always
faster.

Change-Id: Iffd759e368878f39c015258935d8b37de09d9745
This commit is contained in:
Stephen Finucane 2016-07-06 13:27:42 +01:00
parent 5a7e273901
commit 0d6d1616b9

View File

@ -7,16 +7,15 @@ skipsdist = True
usedevelop = True
# tox is silly... these need to be separated by a newline....
whitelist_externals = bash
find
rm
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./nova/tests/unit
LANGUAGE=en_US
LC_ALL=en_US.utf-8
PYTHONDONTWRITEBYTECODE=1
deps = -r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '{posargs}'
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OS_DEBUG
# there is also secret magic in pretty_tox.sh which lets you run in a fail only
@ -34,13 +33,11 @@ commands =
# other way around. See: https://bugs.launchpad.net/testrepository/+bug/1212909
setenv = {[testenv]setenv}
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox3.sh '{posargs}'
[testenv:py35]
setenv = {[testenv]setenv}
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox3.sh '{posargs}'
[testenv:functional]
@ -49,7 +46,6 @@ setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./nova/tests/functional
LANGUAGE=en_US
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '{posargs}'
[testenv:api-samples]
@ -60,7 +56,6 @@ setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./nova/tests/functional/api_sample_tests
LANGUAGE=en_US
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '{posargs}'
[testenv:genconfig]