From: Zack Cerza Date: Thu, 3 Mar 2022 20:22:05 +0000 (-0700) Subject: TeuthologyContextPlugin: Parametrize conditionally X-Git-Tag: 1.2.0~196^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c76e1037eb0cae1ff8a98004bda5dba5bdf4e2c4;p=teuthology.git TeuthologyContextPlugin: Parametrize conditionally So that this plugin can be compatible with our unit tests. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/tests/__init__.py b/teuthology/task/tests/__init__.py index 561d96fa..a510a4a1 100644 --- a/teuthology/task/tests/__init__.py +++ b/teuthology/task/tests/__init__.py @@ -37,7 +37,9 @@ class TeuthologyContextPlugin(object): # this is pytest hook for generating tests with custom parameters def pytest_generate_tests(self, metafunc): # pass the teuthology ctx and config to each test method - metafunc.parametrize(["ctx", "config"], [(self.ctx, self.config),]) + if "ctx" in metafunc.fixturenames and \ + "config" in metafunc.fixturenames: + metafunc.parametrize(["ctx", "config"], [(self.ctx, self.config),]) # log the outcome of each test def pytest_runtest_makereport(self, __multicall__, item, call):