]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
test/test_worker: fix test_prep_job teuth_config mocking 1672/head
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 6 Sep 2021 12:36:55 +0000 (14:36 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 6 Sep 2021 12:36:55 +0000 (14:36 +0200)
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 <kyrylo.shatskyy@suse.com>
teuthology/test/test_worker.py

index 49c3dd1786dd10acb60e96d73c11195f6e89dcd3..b0885b9740bba543d3d07f2f6e2c7cfe024b622e 100644 (file)
@@ -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,