diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index f16066516..e22faf3e5 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -381,12 +381,13 @@ def start(self): def stop(self): + # First, change the status to stopping + self.get_session().stop() + # Prevent discovering new devices whilst stopping if self.get_net_orc().get_listener() is not None: self.get_net_orc().get_listener().stop_listener() - self.get_session().stop() - self._stop_tests() self._stop_network(kill=True) self.get_session().set_status(TestrunStatus.CANCELLED) diff --git a/framework/python/src/net_orc/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py index 90e108a40..b8e7befd2 100644 --- a/framework/python/src/net_orc/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -301,7 +301,10 @@ def _start_device_monitor(self, device): time.sleep(1) # Check Testrun hasn't been cancelled - if self._session.get_status() == TestrunStatus.CANCELLED: + if self._session.get_status() in ( + TestrunStatus.STOPPING, + TestrunStatus.CANCELLED + ): sniffer.stop() return