From 484ad8f402f18ad7ddd47554c8cf251adb4e126e Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Mon, 6 Sep 2021 14:36:55 +0200 Subject: [PATCH] test/test_worker: fix test_prep_job teuth_config mocking When home directory contains .teuthology.yaml the test_prep_job can pick unexpected values, like teuthology_path which makes tests fail. This fix overrides teuthology config to avoid unexpected behaviour. Signed-off-by: Kyr Shatskyy --- teuthology/test/test_worker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/teuthology/test/test_worker.py b/teuthology/test/test_worker.py index 49c3dd1786..b0885b9740 100644 --- a/teuthology/test/test_worker.py +++ b/teuthology/test/test_worker.py @@ -179,8 +179,10 @@ class TestWorker(object): @patch("os.path.isdir") @patch("teuthology.worker.fetch_teuthology") + @patch("teuthology.worker.teuth_config") @patch("teuthology.worker.fetch_qa_suite") def test_prep_job(self, m_fetch_qa_suite, + m_teuth_config, m_fetch_teuthology, m_isdir): config = dict( name="the_name", @@ -191,6 +193,7 @@ class TestWorker(object): m_fetch_teuthology.return_value = '/teuth/path' m_fetch_qa_suite.return_value = '/suite/path' m_isdir.return_value = True + m_teuth_config.teuthology_path = None got_config, teuth_bin_path = worker.prep_job( config, log_file_path, -- 2.39.5