From 40074b088ea1268988c4f9029d47a46e8d4316e9 Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Tue, 4 Jul 2017 08:51:53 +0200 Subject: [PATCH] Fix test for logging change Change of configuration to enable logging by default caused the test to fail because mocked object had no id. This change fixes the test and sets up cleanup for logs --- tests/test_scheduler/test_module_wait.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_scheduler/test_module_wait.py b/tests/test_scheduler/test_module_wait.py index c935e8a4..447d65a3 100644 --- a/tests/test_scheduler/test_module_wait.py +++ b/tests/test_scheduler/test_module_wait.py @@ -30,7 +30,7 @@ import os import vcr import koji from tests import conf, db, app, scheduler_init_data -from module_build_service import conf +from module_build_service import conf, build_logs base_dir = os.path.dirname(os.path.dirname(__file__)) cassette_dir = base_dir + '/vcr-request-data/' @@ -49,6 +49,11 @@ class TestModuleWait(unittest.TestCase): def tearDown(self): self.vcr.__exit__() + try: + path = build_logs.path(1) + os.remove(path) + except: + pass @mock.patch('module_build_service.builder.GenericBuilder.create_from_module') @mock.patch('module_build_service.models.ModuleBuild.from_module_event') @@ -73,6 +78,7 @@ class TestModuleWait(unittest.TestCase): with open(formatted_testmodule_yml_path, 'r') as f: mmd.loads(f) + mocked_module_build.id = 1 mocked_module_build.mmd.return_value = mmd mocked_module_build.component_builds = []