From 6a94a43ee1c4cdf6a754d3e11162280d9255cd93 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 8 Aug 2017 13:41:41 +0200 Subject: [PATCH] Fix test_content_generator tests by ensuring that build_log is removed before running first test --- tests/test_content_generator.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_content_generator.py b/tests/test_content_generator.py index a139fcdc..db8b7f75 100644 --- a/tests/test_content_generator.py +++ b/tests/test_content_generator.py @@ -58,6 +58,13 @@ class TestBuild(unittest.TestCase): self.vcr = vcr.use_cassette(filename) self.vcr.__enter__() + # Ensure that there is no build log from other tests + try: + path = build_logs.path(self.cg.module.id) + os.remove(path) + except OSError: + pass + def tearDown(self): # Necessary to restart the twisted reactor for the next test. import sys @@ -69,7 +76,7 @@ class TestBuild(unittest.TestCase): try: path = build_logs.path(self.cg.module.id) os.remove(path) - except: + except OSError: pass @patch("subprocess.Popen")