From b8c33b62174ec0a6a3cb95503f4148abf5fcdf21 Mon Sep 17 00:00:00 2001 From: TJ Date: Thu, 11 Jul 2024 09:07:11 -0700 Subject: [PATCH] Stop controller during app teardown --- pyproject.toml | 1 - src/can_explorer/app.py | 5 +++-- tests/test_controller.py | 2 +- tests/test_gui.py | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c12150c..199849d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ dearpygui-ext = "^0.9.5" [tool.poetry.group.dev.dependencies] pytest = "^7.2.2" -pytest-order = "^1.2.1" mypy = "^1.2.0" pillow = "^10.3.0" pyautogui = "^0.9.54" diff --git a/src/can_explorer/app.py b/src/can_explorer/app.py index d560916..0817bb9 100644 --- a/src/can_explorer/app.py +++ b/src/can_explorer/app.py @@ -54,8 +54,9 @@ def setup(self): dpg.set_primary_window(app, True) - @staticmethod - def teardown(): + def teardown(self): + if self.controller.is_active(): + self.controller.stop() dpg.destroy_context() def exception_handler(self, exc_type, exc_value, exc_traceback): diff --git a/tests/test_controller.py b/tests/test_controller.py index 3c467cb..d0d9a69 100644 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -28,4 +28,4 @@ def test_controller_populates_data_in_ascending_order(controller, view, vbus1, v time.sleep(0.1) plots = view.plot.get_rows() - assert list(plots) == sorted(plots) + assert plots and list(plots) == sorted(plots) diff --git a/tests/test_gui.py b/tests/test_gui.py index 1c55dff..87fee7e 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -15,8 +15,6 @@ from tests.resources import WITHIN_CI from tests.resources.gui_components import Gui -pytestmark = pytest.mark.order(1) - if HOST_OS == "linux": import Xlib.display from pyvirtualdisplay.smartdisplay import SmartDisplay