We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45416c9 commit 2246ea3Copy full SHA for 2246ea3
1 file changed
backend/tests/config/conftest.py
@@ -0,0 +1,19 @@
1
+import pytest
2
+
3
+from config.config_manager import ConfigManager
4
+from config.config_manager import config_manager as cm
5
6
7
+@pytest.fixture(autouse=True)
8
+def restore_config_manager_singleton():
9
+ """``ConfigManager`` is a process-wide singleton (``__new__`` returns the
10
+ shared instance). Tests in this module point it at temporary config files
11
+ and mutate it (e.g. ``add_platform_binding``), which would otherwise leak
12
+ that state into other test modules through the global ``config_manager``.
13
14
+ Re-initialize the singleton from its original config file after each test
15
+ so the global instance returns to its default state.
16
+ """
17
+ original_config_file = cm.config_file
18
+ yield
19
+ ConfigManager(original_config_file)
0 commit comments