Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions src/test/python/preponderous/graphik/grid3d/test_grid3d_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ def theme():
# -- importing


def test_importing_grid3d_loads_neither_strata_nor_pygame():
def test_importing_grid3d_loads_neither_strata_nor_pygame(monkeypatch):
# monkeypatch puts the deleted modules back afterwards, so later tests
# and the modules they imported keep one copy of each class (a second
# copy of grid3d would raise an Unavailable their imports don't match)
for name in list(sys.modules):
if name == "strata" or name.startswith("strata.") or name.startswith("preponderous.graphik.grid3d"):
del sys.modules[name]
monkeypatch.delitem(sys.modules, name)
graphik = sys.modules.get("preponderous.graphik")
if graphik is not None and hasattr(graphik, "grid3d"):
monkeypatch.delattr(graphik, "grid3d")
pygameLoaded = "pygame" in sys.modules
importlib.import_module("preponderous.graphik.grid3d")
assert "strata" not in sys.modules
Expand Down
Loading
Loading