From c797436528dce3f8d72cf006ee16dcde9cf0bac2 Mon Sep 17 00:00:00 2001
From: Masayuki Igawa <mas-igawa@ut.jp.nec.com>
Date: Tue, 1 Dec 2015 17:11:25 +0900
Subject: [PATCH] Add delete *.pyc command before executing ostestr

This commit adds a command for deleting *.pyc before executing ostestr
with tox. This patch would help that removing unnecessary *.pyc files
when we rename, move or remove *.py ones.

Change-Id: Ifa0eb18a10c7e7ee7e15ce7cc69a1b007a016a76
---
 tox.ini | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index 537b2f2..c436cdb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,9 +8,12 @@ usedevelop = True
 install_command = pip install -U {opts} {packages}
 setenv =
    VIRTUAL_ENV={envdir}
+whitelist_externals = find
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
-commands = ostestr {posargs}
+commands =
+         find . -type f -name "*.pyc" -delete
+         ostestr {posargs}
 
 [testenv:pep8]
 commands = flake8