Skip to content

Commit 232d79c

Browse files
committed
test(legacy)(docs): updated legacy test cases for fast experiments as with the last commit, and updated test logs to document most recent passing case.
1 parent cd126d1 commit 232d79c

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Passed with test_instrument_driver version v0.1.0 tested on pyscan version v0.5.3 at 2024-06-25 10:10:55
1+
Passed with test_instrument_driver version v0.1.0 tested on pyscan version v0.5.3 at 2024-07-05 11:41:28
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Passed with test_voltage version v0.1.0 tested on pyscan version v0.5.3 at 2024-06-25 10:10:55
1+
Passed with test_voltage version v0.1.0 tested on pyscan version v0.5.3 at 2024-07-05 11:41:28

test/legacy/measurement/test_legacy_experiment.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import shutil
99
import numpy as np
1010
import pytest
11+
import re
12+
import os
1113

1214

1315
##################### FUNCTIONS USED BY TEST CASES #####################
@@ -1126,21 +1128,33 @@ def get_voltage_data(ms):
11261128

11271129
# Create RunInfo instance and set scan0 to PropertyScan
11281130
runinfo = ps.RunInfo()
1129-
runinfo.scan0 = ps.PropertyScan({'v1': ps.drange(0, 0.1, 1)}, prop='voltage', dt=0.000000001)
1131+
runinfo.scan0 = ps.RepeatScan(1, dt=0.0000001)
11301132

11311133
# Set RunInfo measure_function (remember, it takes a Experiment object as a parameter and
11321134
# returns an ItemAttribute containing data).
11331135
runinfo.measure_function = get_voltage_data
11341136

11351137
# Create a Experiment class with the RunInfo and Devices just created
11361138
ms = ps.Sweep(runinfo, devices, time=True)
1137-
try:
1138-
ms.run()
1139-
ms.run()
1140-
ms.run()
1141-
ms.run()
1142-
ms.run()
1143-
ms.run()
1139+
1140+
long_names = []
1141+
1142+
while len(long_names) < 3:
11441143
ms.run()
1145-
except Exception:
1146-
assert False, f"Fast experiments did not run properly, possible file name overlap. Exception: {Exception}"
1144+
if len(long_names) == 0:
1145+
long_names.append(ms.runinfo.long_name)
1146+
elif (ms.runinfo.long_name[:15] == long_names[0][:15]):
1147+
long_names.append(ms.runinfo.long_name)
1148+
else:
1149+
long_names = [ms.runinfo.long_name]
1150+
1151+
err_str = f"First long name '{long_names[0]}' does not match expected date/time format."
1152+
assert re.match(r'^\d{8}T\d{6}$', long_names[0]), err_str
1153+
err_str = f"-1 long name '{long_names[1]}' does not match expected increment or format."
1154+
assert long_names[1] == long_names[0] + '-1', err_str
1155+
err_str = f"-2 long name '{long_names[1]}' does not match expected increment or format."
1156+
assert long_names[2] == long_names[0] + '-2', err_str
1157+
1158+
for name in long_names:
1159+
save_path = ms.runinfo.data_path / '{}.hdf5'.format(name)
1160+
assert os.path.exists(save_path), f"Expected file at path'{save_path}' was not found."

0 commit comments

Comments
 (0)