Modify sys.modules in place rather than replacing the dictionary
The lazy imports feature added in Python 3.15 holds a reference to the original sys.modules, causing issues when the test fixture replaces it during the test run. The tests, run individually, pass, but in the sequential run - fail. See: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/201#comment-333958
This commit is contained in:
parent
5487373637
commit
f7eefdbf58
1 changed files with 2 additions and 1 deletions
|
|
@ -20,7 +20,8 @@ def preserve_sys_path():
|
|||
def preserve_sys_modules():
|
||||
original_sys_modules = dict(sys.modules)
|
||||
yield
|
||||
sys.modules = original_sys_modules
|
||||
sys.modules.clear()
|
||||
sys.modules.update(original_sys_modules)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue