Skip to content

Commit 04ca925

Browse files
test updated
1 parent 150489c commit 04ca925

5 files changed

Lines changed: 11 additions & 5 deletions

File tree

Keithley_2400/Backends/IV_K2400_Loop_Backend_v10.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def main():
3232
Main function to run the I-V sweep measurement.
3333
"""
3434
# object creation ----------------------------------
35-
keithley_2400 = Keithley2400("GPIB::4")
35+
keithley_2400 = Keithley2400("GPIB::4", adapter_args={"py_library": "@sim"})
3636
keithley_2400.disable_buffer()
3737
sleep(2)
3838

Keithley_6517B/High_Resistance/Backends/IV_K6517B_Simple_Backend_v10.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def main():
8989

9090
# --- 2. CONNECT TO INSTRUMENT (V5 Logic) ---
9191
print(f"\nAttempting to connect to instrument at: {VISA_ADDRESS}")
92-
keithley = Keithley6517B(VISA_ADDRESS)
92+
keithley = Keithley6517B(VISA_ADDRESS, adapter_args={"py_library": "@sim"})
9393
print(f"Successfully connected to: {keithley.id}")
9494

9595
# --- 3. CONFIGURE MEASUREMENT (V5 Logic) ---

tests/test_fixes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_iv_k2400_fix(self, mock_to_csv, mock_plt_show, mock_keithley_class, moc
2323
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.Lakeshore350')
2424
@patch('matplotlib.pyplot.show')
2525
@patch('builtins.open', new_callable=mock_open)
26-
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.sleep', MagicMock())
26+
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.time.sleep', MagicMock())
2727
@patch('time.time', side_effect=[1000, 1002, 1004, 1006, 1008, 1010])
2828
def test_t_control_l350_fix(self, mock_time, mock_open_file,
2929
mock_plt_show, mock_ls_class, mock_input, mock_file_dialog, mock_tk):

tests/test_gui_iv_k2400.py

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

2525
@patch('Keithley_2400.IV_K2400_GUI_v5.Keithley2400_IV_Backend')
26-
@patch('matplotlib.figure.Figure.subplots')
26+
@patch('Keithley_2400.IV_K2400_GUI_v5.Figure.subplots')
2727
def test_start_measurement_logic(self, mock_fig_subplots, MockBackend):
2828
"""
2929
Tests the core logic of the 'Start' button click.

tests/test_t_control_l350_backend.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ def test_get_user_parameters(self, mock_input):
9999
@patch('time.sleep', MagicMock())
100100
# Simulate time passing
101101
@patch('time.time', side_effect=[1000, 1002, 1004, 1006, 1008, 1010])
102-
def test_main_runs_and_completes(self, mock_time, mock_open_file,
102+
@patch('Lakeshore_350_340.Backends.T_Control_L350_Simple_Backend_v10.pyvisa.ResourceManager')
103+
def test_main_runs_and_completes(self, mock_rm, mock_time, mock_open_file,
103104
mock_plt_show, mock_ls_class, mock_input, mock_file_dialog, mock_tk):
104105
# --- MOCK SETUP ---
106+
# Configure mock_rm to return a mock instrument
107+
mock_instrument_from_rm = MagicMock()
108+
mock_rm.return_value.open_resource.return_value = mock_instrument_from_rm
109+
mock_instrument_from_rm.query.return_value = "LSCI,MODEL350,12345,1.0" # IDN query
110+
105111
mock_controller = MagicMock()
106112
mock_ls_class.return_value = mock_controller
107113

0 commit comments

Comments
 (0)