From: Zack Cerza Date: Thu, 3 Mar 2022 21:35:53 +0000 (-0700) Subject: test_run: Skip a test if running in teuth process X-Git-Tag: 1.2.0~196^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=770a670a0605f9005d0f4418599193a393e83761;p=teuthology.git test_run: Skip a test if running in teuth process Signed-off-by: Zack Cerza --- diff --git a/teuthology/test/test_exit.py b/teuthology/test/test_exit.py index 939bcadfb..b7004fd75 100644 --- a/teuthology/test/test_exit.py +++ b/teuthology/test/test_exit.py @@ -5,6 +5,7 @@ import signal from unittest.mock import patch, Mock from teuthology import exit +from teuthology.test import skipif_teuthology_process class TestExiter(object): @@ -39,6 +40,7 @@ class TestExiter(object): self.patcher_kill.stop() del self.m_kill + @skipif_teuthology_process def test_noop(self): sig = 15 obj = self.klass() diff --git a/teuthology/test/test_run.py b/teuthology/test/test_run.py index f08082f58..5c99d755c 100644 --- a/teuthology/test/test_run.py +++ b/teuthology/test/test_run.py @@ -5,6 +5,7 @@ from unittest.mock import patch, call, Mock from teuthology import run from scripts import run as scripts_run +from teuthology.test import skipif_teuthology_process class TestRun(object): @@ -108,6 +109,13 @@ class TestRun(object): assert {'internal.vm_setup': None} in result assert {'internal.buildpackages_prep': None} in result + # When tests are run in a teuthology process using the py.test + # API, tasks will have already been imported. Patching sys.path + # (and even calling sys.path_importer_cache.clear()) doesn't seem + # to help "forget" where the tasks are, keeping this test from + # passing. The test isn't critical to run in every single + # environment, so skip. + @skipif_teuthology_process @patch("teuthology.run.fetch_qa_suite") def test_fetch_tasks_if_needed(self, m_fetch_qa_suite): config = {"suite_path": "/some/suite/path", "suite_branch": "feature_branch",