Skip to content

Commit d8bd498

Browse files
tests updated
1 parent 03cf7e2 commit d8bd498

4 files changed

Lines changed: 1065 additions & 931 deletions

File tree

tests/test_gui_iv_k2400.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@ def tearDown(self):
2323
self.root.destroy()
2424

2525
@patch('Keithley_2400.IV_K2400_GUI_v5.Keithley2400_IV_Backend')
26-
def test_start_measurement_logic(self, MockBackend):
26+
@patch('matplotlib.figure.Figure')
27+
def test_start_measurement_logic(self, MockFigure, MockBackend):
2728
"""
2829
Tests the core logic of the 'Start' button click.
2930
Verifies that parameters are read from the UI and passed to the backend correctly.
3031
"""
3132
# --- Setup ---
3233
# Instantiate the GUI. This also creates all the tk widgets.
34+
# --- FIX: Configure the mock for Figure.subplots ---
35+
mock_figure_instance = MockFigure.return_value
36+
mock_ax_vi = MagicMock()
37+
mock_ax_ri = MagicMock()
38+
mock_figure_instance.subplots.return_value = (mock_ax_vi, mock_ax_ri)
3339
app = MeasurementAppGUI(self.root)
3440

3541
# Mock the backend instance that the GUI will create

tests/test_iv_k6517b_simple_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TestIVK6517BSimpleBackend(unittest.TestCase):
88

99
@patch('builtins.input', side_effect=['-10', '10', '5', '0.1', 'test_iv_simple.csv'])
10-
@patch('pymeasure.instruments.keithley.Keithley6517B')
10+
@patch('Keithley_6517B.High_Resistance.Backends.IV_K6517B_Simple_Backend_v10.Keithley6517B')
1111
@patch('builtins.open', new_callable=mock_open)
1212
@patch('matplotlib.pyplot.show')
1313
def test_full_run(self, mock_show, mock_file, mock_keithley_class, mock_input):

tests/test_t_control_l350_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_get_user_parameters(self, mock_input):
9393
@patch('tkinter.Tk')
9494
@patch('tkinter.filedialog.asksaveasfilename', return_value='test.csv')
9595
@patch('builtins.input', side_effect=['10', '20', '5', '30'])
96-
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.Lakeshore350') # This patch is correct as it targets the class in the script's namespace
96+
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.Lakeshore350')
9797
@patch('matplotlib.pyplot.show')
9898
@patch('builtins.open', new_callable=mock_open)
9999
@patch('time.sleep', MagicMock())

0 commit comments

Comments
 (0)