fix moler_config() fixture - it should restore values and not clear them (to not impact other tests)
@@ -168,11 +168,18 @@ def test_load_config_checks_env_variable_existence(moler_config):
@pytest.yield_fixture
def moler_config():
+ import mock
import moler.config as moler_cfg
- moler_cfg.loaded_config = "NOT_LOADED_YET"
+ import moler.config.connections as conn_cfg
+
+ empty_default_variant = {}
+ empty_named_connections = {}
+ empty_loaded_config = ["NOT_LOADED_YET"]
+
+ with mock.patch.object(conn_cfg, "default_variant", empty_default_variant):
+ with mock.patch.object(conn_cfg, "named_connections", empty_named_connections):
+ with mock.patch.object(moler_cfg, "loaded_config", empty_loaded_config):
yield moler_cfg
- # restore since tests may change configuration
- moler_cfg.clear()
@pytest.yield_fixture
