Skip to content

Commit 3bb355b

Browse files
committed
Check if module is present before removing it
Apparently not all tests that add modules to the PAGE_REGISTRY also add them to sys.modules.
1 parent a95fb6d commit 3bb355b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def clear_pages_state():
2323
def init_pages_state():
2424
"""Clear all global state that is used by pages feature."""
2525
for page in dash._pages.PAGE_REGISTRY.values():
26-
sys.modules.pop(page["module"])
26+
if page["module"] in sys.modules:
27+
sys.modules.pop(page["module"])
2728
dash._pages.PAGE_REGISTRY.clear()
2829
dash._pages.CONFIG.clear()
2930
dash._pages.CONFIG.__dict__.clear()

0 commit comments

Comments
 (0)