Skip to content

Commit 5ff9b2b

Browse files
Update test_full_stack_simulation.py
added mock the submodule matplotlib.figure.
1 parent 4fd2da6 commit 5ff9b2b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/test_full_stack_simulation.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
sys.modules['tkinter.ttk'] = MagicMock()
1111
sys.modules['tkinter.messagebox'] = MagicMock()
1212
sys.modules['tkinter.filedialog'] = MagicMock()
13+
14+
# Matplotlib Mocks (Fixed the missing modules here)
1315
sys.modules['matplotlib'] = MagicMock()
1416
sys.modules['matplotlib.pyplot'] = MagicMock()
17+
sys.modules['matplotlib.figure'] = MagicMock() # <--- ADDED THIS
18+
sys.modules['matplotlib.gridspec'] = MagicMock() # <--- ADDED THIS (Just in case)
19+
sys.modules['matplotlib.backends'] = MagicMock()
1520
sys.modules['matplotlib.backends.backend_tkagg'] = MagicMock()
21+
1622
sys.modules['pyvisa'] = MagicMock()
1723
sys.modules['pymeasure'] = MagicMock()
1824
sys.modules['PIL'] = MagicMock()
@@ -52,6 +58,9 @@ def test_launcher_buttons(self):
5258
app.launch_script(target_script)
5359

5460
# ASSERTION 1: Did we try to spawn a process?
61+
if not MockProcess.called:
62+
print(" [Error] Process not spawned. Script might have crashed during import.")
63+
5564
MockProcess.assert_called()
5665

5766
# ASSERTION 2: Did we pass the correct script?

0 commit comments

Comments
 (0)