Skip to content

Commit 2246ea3

Browse files
committed
fix tests
1 parent 45416c9 commit 2246ea3

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

backend/tests/config/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)