Clean up artifacts before test runs, not after

When tests fail, artifacts from that tests are necessary to properly
debug the failure and determine how to fix the test. This is impossible
when artifacts are immediately removed after the test is finished.
Instead, the tests should remove old artifacts before the test run
begins.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
Steve Kuznetsov 2017-01-09 09:56:48 -05:00
parent 25c3aeed71
commit 4f36972414
No known key found for this signature in database
GPG key ID: 366E054B30FC03A2
2 changed files with 8 additions and 3 deletions

View file

@ -15,9 +15,10 @@
"""
Executes all tests.
"""
import sys
import os
import shutil
import sys
import tempfile
# Make sure we run from the source, this is tricky because the functional
# tests need to find both the location of the 'tito' executable script,
@ -39,4 +40,9 @@ if __name__ == '__main__':
print("Using nose %s" % nose.__version__[0:3])
print("Running tito tests against: %s" % SRC_DIR)
# Make sure no older test directories exist
for dir in os.listdir(tempfile.gettempdir()):
if dir.endswith('-titotest'):
shutil.rmtree(os.path.join(tempfile.gettempdir(), dir))
nose.main()

View file

@ -128,7 +128,6 @@ class TitoGitTestFixture(unittest.TestCase):
def tearDown(self):
run_command('chmod -R u+rw %s' % self.repo_dir)
shutil.rmtree(self.repo_dir)
pass
def write_file(self, path, contents):