Skip to content

Commit 8d7a800

Browse files
authored
use a fixture to always clear _shared_cache (Open-MSS#3048)
1 parent 692ca5d commit 8d7a800

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

‎tests/_test_msui/conftest.py‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
4+
tests._test_msui.conftest
5+
~~~~~~~~~~~~~~~~~~~~~~~~~
6+
7+
common definitions for _test_msui
8+
9+
This file is part of MSS.
10+
11+
:copyright: Copyright 2016-2017 Reimar Bauer
12+
:copyright: Copyright 2016-2026 by the MSS team, see AUTHORS.
13+
:license: APACHE-2.0, see LICENSE for details.
14+
15+
Licensed under the Apache License, Version 2.0 (the "License");
16+
you may not use this file except in compliance with the License.
17+
You may obtain a copy of the License at
18+
19+
http://www.apache.org/licenses/LICENSE-2.0
20+
21+
Unless required by applicable law or agreed to in writing, software
22+
distributed under the License is distributed on an "AS IS" BASIS,
23+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24+
See the License for the specific language governing permissions and
25+
limitations under the License.
26+
"""
27+
import pytest
28+
from mslib.utils.service_manager import WMSServiceManager
29+
30+
31+
@pytest.fixture(autouse=True)
32+
def _reset_wms_service_manager():
33+
WMSServiceManager._shared_cache.clear()
34+
yield
35+
WMSServiceManager._shared_cache.clear()

‎tests/_test_msui/test_wms_control.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import socket
3434
from PyQt5 import QtCore, QtTest
3535
from mslib.msui import flighttrack as ft
36-
from mslib.utils.service_manager import WMSServiceManager
3736
import mslib.msui.wms_control as wc
3837

3938

@@ -57,8 +56,6 @@ def _with_mswms_server(self, mswms_server):
5756
self.scheme, self.host, self.port = parsed_url.scheme, parsed_url.hostname, parsed_url.port
5857

5958
def _setup(self, widget_type, tmp_path):
60-
self.service_manager = WMSServiceManager()
61-
self.service_manager.clear_cache()
6259
if widget_type == "hsec":
6360
self.view = HSecViewMockup()
6461
else:
@@ -501,8 +498,6 @@ class TestWMSControlWidgetSetupSimple:
501498

502499
@pytest.fixture(autouse=True)
503500
def setup(self, tmp_path, qtbot):
504-
self.service_manager = WMSServiceManager()
505-
self.service_manager.clear_cache()
506501
self.view = HSecViewMockup()
507502
self.tempdir = tmp_path
508503
self.window = wc.HSecWMSControlWidget(view=self.view, wms_cache=self.tempdir)

0 commit comments

Comments
 (0)