From a2abc0c2af132e0a732442b6bea5a91d19944a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Tue, 17 Dec 2024 12:06:55 +0100 Subject: [PATCH] speed up tests --- Software/Integrationtests/tests/TestBase.py | 11 +++++++---- Software/Integrationtests/tests/TestRST.py | 6 ------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Software/Integrationtests/tests/TestBase.py b/Software/Integrationtests/tests/TestBase.py index 2213005b..c5c63e1f 100644 --- a/Software/Integrationtests/tests/TestBase.py +++ b/Software/Integrationtests/tests/TestBase.py @@ -14,15 +14,16 @@ def setUp(self): timeout = time.time() + 3; poll_obj = select.poll() poll_obj.register(self.gui.stdout, select.POLLIN) - while time.time() < timeout: + while True: poll_result = poll_obj.poll(0) if poll_result: line = self.gui.stdout.readline().decode().strip() if "Listening on port 19544" in line: break - - time.sleep(1) - + if time.time() >= timeout: + self.tearDown() + raise AssertionError("Timed out waiting for SCPI server") + self.vna = libreVNA('localhost', 19544, timeout=4) try: self.vna.cmd("*CLS;:DEV:CONN") @@ -34,6 +35,8 @@ def setUp(self): raise AssertionError("Not connected") def tearDown(self): + # make sure the GUI did not crash during the test + self.assertEqual(self.gui.poll(), None) self.gui.send_signal(SIGINT) try: self.gui.wait(timeout = 3) diff --git a/Software/Integrationtests/tests/TestRST.py b/Software/Integrationtests/tests/TestRST.py index 84dceba5..34719346 100644 --- a/Software/Integrationtests/tests/TestRST.py +++ b/Software/Integrationtests/tests/TestRST.py @@ -236,16 +236,10 @@ def test_rst_hard(self): self.vna.cmd(f"VNA:STIM:FREQ {f_1_3}") self.vna.cmd(f"VNA:STIM:LVL {pwr_min}") self.vna.cmd("VNA:SWEEP POWER") - - # We just configured a lot of settings, give some time to empty the output queue from the GUI to the device - time.sleep(2) # Reset and verify all settings revert. self.vna.cmd("*RST") - # ... and wait a little bit here again to let the changes from the RST propagate from the device and back to the GUI (otherwise we might still read wrong external reference settings for example) - time.sleep(2) - settings2 = self.query_settings() for key, value in settings1.items(): self.assertEqual(value, settings2[key])