From c76e1037eb0cae1ff8a98004bda5dba5bdf4e2c4 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 3 Mar 2022 13:22:05 -0700 Subject: [PATCH] TeuthologyContextPlugin: Parametrize conditionally So that this plugin can be compatible with our unit tests. Signed-off-by: Zack Cerza --- teuthology/task/tests/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teuthology/task/tests/__init__.py b/teuthology/task/tests/__init__.py index 561d96faf..a510a4a1c 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): -- 2.47.3