From 6bb97044c22b241c6b1e6d3e35df14131ca2547c Mon Sep 17 00:00:00 2001 From: shu-mutou Date: Wed, 2 Dec 2015 15:31:04 +0900 Subject: [PATCH] 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. Change-Id: Ibaac514521bab11bbf552e0310d1203230c0d984 Closes-Bug: #1368661 --- tox.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a4670156..d7babc7c 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,11 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --testr-args="{posargs}" +commands = sh -c 'find . -not \( -type d -name .?\* -prune \) \ + \( -type d -name "__pycache__" -or -type f -name "*.py[co]" \) \ + -print0 | xargs -0 rm -rf' + python setup.py testr --testr-args="{posargs}" +whitelist_externals = sh passenv = SWIFT_* *_proxy [testenv:pep8]