diff options
author | shu-mutou <shu-mutou@rf.jp.nec.com> | 2015-12-02 12:19:19 +0900 |
---|---|---|
committer | Ihar Hrachyshka <ihrachys@redhat.com> | 2016-03-23 16:05:03 +0000 |
commit | 714055857fa669f8fa57056f22bafde2686727c7 (patch) | |
tree | 8d2d7041ada02fd703d97903f05964c728c62887 | |
parent | c1701c1d289beed3710b17653e386bb3fbffb0c7 (diff) | |
download | python-neutronclient-714055857fa669f8fa57056f22bafde2686727c7.tar.gz |
Delete python bytecode before every test run
Because python creates pyc|pyo files and __pycache__
directories during tox runs, certain changes in the tree,
like deletes of files, or switching branches, can create
spurious errors.
The target bytecodes for deletion are in normal directories,
but not in dot started directory.
Change-Id: Iee36c67d2e5e4d9e78b1b1b493030761e0f46e3c
Closes-Bug: #1368661
(cherry picked from commit 83d61566cee8b8e786b46103cf3e72fbe8077c1a)
-rw-r--r-- | tox.ini | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -13,7 +13,14 @@ usedevelop = True install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --testr-args='{posargs}' +# Delete bytecodes from normal directories before running tests. +# Note that bytecodes in dot directories will not be deleted +# to keep bytecodes of python modules installed into virtualenvs. +commands = sh -c "find . -type d -name '.?*' -prune -o \ + \( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \ + -print0 | xargs -0 rm -rf" + python setup.py testr --testr-args='{posargs}' +whitelist_externals = sh [testenv:pep8] commands = flake8 |