Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/unit/cli/test_cli_new_scaffold_runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ def importable_src() -> Iterator[list[str]]:
"""
added: list[str] = []
original_path = list(sys.path)
original_modules = set(sys.modules)
original_modules = dict(sys.modules)
yield added
sys.path[:] = original_path
for name in set(sys.modules) - original_modules:
for name in set(sys.modules) - set(original_modules):
del sys.modules[name]
# Put the pre-existing entries back verbatim. The purge above only removes
# names the scaffold run itself introduced, so this restore is a no-op in
# the common case -- but it makes the fixture provably incapable of leaking
# an OMN-14944-class eviction even if a scaffold import displaces an
# already-cached module, and it is the explicit restore the OMN-14985
# ratchet (test_no_unrestored_del_sys_modules_in_tests) requires to see.
sys.modules.update(original_modules)


def _scaffold(
Expand Down
Loading