diff --git a/Software/Integrationtests/libreCAL.py b/Software/Integrationtests/libreCAL.py index 03a8927..33cf78a 100644 --- a/Software/Integrationtests/libreCAL.py +++ b/Software/Integrationtests/libreCAL.py @@ -6,12 +6,13 @@ class libreCAL: def __init__(self, serialnum = ''): self.ser = None for p in serial.tools.list_ports.comports(): - if p.vid == 0x0483 and p.pid == 0x4122: + if (p.vid == 0x0483 and p.pid == 0x4122) or (p.vid == 0x1209 and p.pid == 0x4122): self.ser = serial.Serial(p.device, timeout = 1) - idn = self.SCPICommand("*IDN?").split("_") + idn = self.SCPICommand("*IDN?").split(",") if idn[0] != "LibreCAL": + self.ser = None continue - self.serial = idn[1] + self.serial = idn[2] if len(serialnum) > 0: # serial number specified, compare if self.serial != serialnum: @@ -70,7 +71,13 @@ class libreCAL: def getHeaterPower(self): return float(self.SCPICommand(":HEAT:POW?")) - + + def getDateTimeUTC(self): + return self.SCPICommand(":DATE_TIME?") + + def setDateTimeUTC(self, date_time_utc): + return self.SCPICommand(":DATE_TIME "+ date_time_utc) + def SCPICommand(self, cmd: str) -> str: self.ser.write((cmd+"\r\n").encode()) resp = self.ser.readline().decode("ascii") @@ -78,4 +85,4 @@ class libreCAL: raise Exception("Timeout occurred in communication with LibreCAL") if resp.strip() == "ERROR": raise Exception("LibreCAL returned 'ERROR' for command '"+cmd+"'") - return resp.strip() \ No newline at end of file + return resp.strip() diff --git a/Software/Integrationtests/tests/TestBase.py b/Software/Integrationtests/tests/TestBase.py index 983bd53..3f5dfeb 100644 --- a/Software/Integrationtests/tests/TestBase.py +++ b/Software/Integrationtests/tests/TestBase.py @@ -32,6 +32,8 @@ class TestBase(unittest.TestCase): if self.vna.query(":DEV:CONN?") == "Not connected": self.tearDown() raise AssertionError("Not connected") + # Tests occasionally fail without this timeout - give GUI a little bit more time to properly start + time.sleep(1) def tearDown(self): self.gui.send_signal(SIGINT) diff --git a/Software/Integrationtests/tests/TestCalibration.py b/Software/Integrationtests/tests/TestCalibration.py index 5fb7a14..65f82d4 100644 --- a/Software/Integrationtests/tests/TestCalibration.py +++ b/Software/Integrationtests/tests/TestCalibration.py @@ -8,7 +8,7 @@ class TestCalibration(TestBase): self.vna.cmd(":VNA:CAL:MEAS "+str(number)) # wait for the measurement to finish assert self.vna.query(":VNA:CAL:BUSY?") == "TRUE" - self.vna.cmd("*WAI") + self.vna.cmd("*WAI", timeout=timeout) assert self.vna.query(":VNA:CAL:BUSY?") == "FALSE" def test_dummy_calibration(self): @@ -152,9 +152,9 @@ class TestCalibration(TestBase): # Start measurement and grab data self.vna.cmd(":VNA:ACQ:SINGLE TRUE") - self.assertEqual(self.vna.query(":VNA:ACQ:FIN?") == "FALSE") + self.assertEqual(self.vna.query(":VNA:ACQ:FIN?"), "FALSE") self.vna.cmd("*WAI") - self.assertEqual(self.vna.query(":VNA:ACQ:FIN?") == "TRUE") + self.assertEqual(self.vna.query(":VNA:ACQ:FIN?"), "TRUE") cal.reset() diff --git a/Software/Integrationtests/tests/TestRST.py b/Software/Integrationtests/tests/TestRST.py index 9ed9c4c..c86021c 100644 --- a/Software/Integrationtests/tests/TestRST.py +++ b/Software/Integrationtests/tests/TestRST.py @@ -1,5 +1,6 @@ import re from tests.TestBase import TestBase +import time float_re = re.compile(r'^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]\d+)?$') int_re = re.compile(r'^\d+$') @@ -240,7 +241,4 @@ class TestRST(TestBase): self.vna.cmd("*RST") settings2 = self.query_settings() for key, value in settings1.items(): - # TODO-check: *RST does not reset this parameter. - if key == "DEV:REF:OUT": - continue self.assertEqual(value, settings2[key])