From 674129db9df8481773848d25a6e70bed82f83224 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 1 Aug 2024 13:50:51 -0600 Subject: [PATCH] suite: Ensure teuthology config is consistent between tests test_init.py was making modifications to the config object that persisted between tests. When I fixed that, initially some tests in test_run_.py started failing because of settings in my local ~/.teuthology.yaml. This change causes all of the tests in suite.test to use default config values. Signed-off-by: Zack Cerza --- teuthology/config.py | 7 ++++--- teuthology/suite/test/conftest.py | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 teuthology/suite/test/conftest.py diff --git a/teuthology/config.py b/teuthology/config.py index 3983d3d0f9..55fa966c23 100644 --- a/teuthology/config.py +++ b/teuthology/config.py @@ -33,12 +33,13 @@ class YamlConfig(MutableMapping): self._conf = dict() def load(self, conf=None): - if conf: + if conf is not None: if isinstance(conf, dict): self._conf = conf - else: + return + elif conf: self._conf = yaml.safe_load(conf) - return + return if os.path.exists(self.yaml_path): with open(self.yaml_path) as f: self._conf = yaml.safe_load(f) diff --git a/teuthology/suite/test/conftest.py b/teuthology/suite/test/conftest.py new file mode 100644 index 0000000000..4285bdcfcd --- /dev/null +++ b/teuthology/suite/test/conftest.py @@ -0,0 +1,4 @@ +from teuthology.config import config + +def pytest_runtest_setup(): + config.load({}) -- 2.39.5