From cd6928fd1811cfbc14f7011e9efae1f59cb8afe5 Mon Sep 17 00:00:00 2001 From: Reimar Bauer Date: Mon, 30 Mar 2026 18:15:53 +0200 Subject: [PATCH 1/2] use a fixture to always clear _shared_cache --- tests/_test_msui/conftest.py | 35 ++++++++++++++++++++++++++++ tests/_test_msui/test_wms_control.py | 5 ---- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 tests/_test_msui/conftest.py diff --git a/tests/_test_msui/conftest.py b/tests/_test_msui/conftest.py new file mode 100644 index 000000000..29e13266a --- /dev/null +++ b/tests/_test_msui/conftest.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +""" + + tests._test_msui.conftest + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + common definitions for _test_msui + + This file is part of MSS. + + :copyright: Copyright 2016-2017 Reimar Bauer + :copyright: Copyright 2016-2026 by the MSS team, see AUTHORS. + :license: APACHE-2.0, see LICENSE for details. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" +import pytest +from mslib.utils.service_manager import WMSServiceManager + + +@pytest.fixture(autouse=True) +def _reset_wms_service_manager(): + WMSServiceManager._shared_cache.clear() + yield + WMSServiceManager._shared_cache.clear() \ No newline at end of file diff --git a/tests/_test_msui/test_wms_control.py b/tests/_test_msui/test_wms_control.py index 219964c04..4bb238f52 100644 --- a/tests/_test_msui/test_wms_control.py +++ b/tests/_test_msui/test_wms_control.py @@ -33,7 +33,6 @@ import eventlet from PyQt5 import QtCore, QtTest from mslib.msui import flighttrack as ft -from mslib.utils.service_manager import WMSServiceManager import mslib.msui.wms_control as wc @@ -57,8 +56,6 @@ def _with_mswms_server(self, mswms_server): self.scheme, self.host, self.port = parsed_url.scheme, parsed_url.hostname, parsed_url.port def _setup(self, widget_type, tmp_path): - self.service_manager = WMSServiceManager() - self.service_manager.clear_cache() if widget_type == "hsec": self.view = HSecViewMockup() else: @@ -500,8 +497,6 @@ class TestWMSControlWidgetSetupSimple: @pytest.fixture(autouse=True) def setup(self, tmp_path, qtbot): - self.service_manager = WMSServiceManager() - self.service_manager.clear_cache() self.view = HSecViewMockup() self.tempdir = tmp_path self.window = wc.HSecWMSControlWidget(view=self.view, wms_cache=self.tempdir) From 834827c03b48ee52fe06aaa29601edf4f9982d99 Mon Sep 17 00:00:00 2001 From: Reimar Bauer Date: Mon, 30 Mar 2026 18:19:22 +0200 Subject: [PATCH 2/2] linter --- tests/_test_msui/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_test_msui/conftest.py b/tests/_test_msui/conftest.py index 29e13266a..6ccfa2ffb 100644 --- a/tests/_test_msui/conftest.py +++ b/tests/_test_msui/conftest.py @@ -32,4 +32,4 @@ def _reset_wms_service_manager(): WMSServiceManager._shared_cache.clear() yield - WMSServiceManager._shared_cache.clear() \ No newline at end of file + WMSServiceManager._shared_cache.clear()