]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
TeuthologyContextPlugin: Parametrize conditionally
authorZack Cerza <zack@redhat.com>
Thu, 3 Mar 2022 20:22:05 +0000 (13:22 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 16 Mar 2022 22:51:16 +0000 (16:51 -0600)
So that this plugin can be compatible with our unit tests.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/tests/__init__.py

index 561d96fafe680e96785c16e32c0d154fa46a328f..a510a4a1cc8e83d5d15d776647d1d9544a755926 100644 (file)
@@ -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):