Skip to content

Commit 2a15ff9

Browse files
committed
make-test-robust
1 parent 20616f6 commit 2a15ff9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_formatters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_display_formatter_active_types_config():
6262
from traitlets.config import Config
6363

6464
# Clear HistoryManager instances to bypass singleton limit before creating new shell
65+
prev_instances = HistoryManager._instances.copy()
6566
HistoryManager._instances.clear()
6667

6768
try:
@@ -73,8 +74,13 @@ def test_display_formatter_active_types_config():
7374
active_types = ip.display_formatter.active_types
7475
assert "text/plain" in active_types
7576
assert "image/png" in active_types
77+
78+
# Ensure only the expected types are active
79+
assert set(active_types) == {"text/plain", "image/png"}
7680
finally:
81+
# Clean up the new instance and restore previous state
7782
HistoryManager._instances.clear()
83+
HistoryManager._instances.update(prev_instances)
7884

7985

8086
def test_pretty():

0 commit comments

Comments
 (0)