diff --git a/tests/conftest.py b/tests/conftest.py index 6934a959b..d11c4e2c4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -90,6 +90,16 @@ def resources(): return Path(__file__).resolve().with_name('resources') +@fixture() +def test_config_yaml(resources): + """ + Path to YAML tests config file. + + :return: path to yaml config file + """ + return resources / 'c.yml' + + # <=><=><=><=><=> dcsbios <=><=><=><=><=> @fixture def protocol_parser(): @@ -200,7 +210,7 @@ def default_config(): @fixture() -def switch_dcs_bios_path_in_config(resources): +def switch_dcs_bios_path_in_config(resources, test_config_yaml): """ Switch path to config yaml file during testing. @@ -208,13 +218,13 @@ def switch_dcs_bios_path_in_config(resources): """ from dcspy import utils - org = utils.load_yaml(resources / 'c.yml') + org = utils.load_yaml(test_config_yaml) dcs_bios = org['dcsbios'] org['dcsbios'] = str(resources / 'dcs_bios') - utils.save_yaml(data=org, full_path=resources / 'c.yml') + utils.save_yaml(data=org, full_path=test_config_yaml) yield org['dcsbios'] = dcs_bios - utils.save_yaml(data=org, full_path=resources / 'c.yml') + utils.save_yaml(data=org, full_path=test_config_yaml) # <=><=><=><=><=> DCS World autoupdate_cfg <=><=><=><=><=> diff --git a/tests/test_qtgui.py b/tests/test_qtgui.py index 0c613d124..18680910b 100644 --- a/tests/test_qtgui.py +++ b/tests/test_qtgui.py @@ -6,7 +6,7 @@ @mark.qt6 @mark.skipif(condition=platform != 'win32', reason='Run only on Windows') -def test_qt(qtbot, resources, switch_dcs_bios_path_in_config): +def test_qt(qtbot, test_config_yaml, switch_dcs_bios_path_in_config): from time import sleep from PySide6 import QtCore @@ -18,7 +18,7 @@ def test_qt(qtbot, resources, switch_dcs_bios_path_in_config): QQuickWindow.setGraphicsApi(QSGRendererInterface.OpenGLRhi) QtCore.QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts) - with patch('dcspy.qt_gui.default_yaml', resources / 'c.yml'): + with patch('dcspy.qt_gui.default_yaml', test_config_yaml): dcspy_gui = qt_gui.DcsPyQtGui() dcspy_gui.show() qtbot.addWidget(dcspy_gui) diff --git a/tests/test_utils.py b/tests/test_utils.py index 6d5692432..d0a279d91 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -85,7 +85,7 @@ def test_proc_is_running(): def test_dummy_save_load_set_defaults(tmpdir): from os import environ - test_tmp_yaml = Path(tmpdir) / 'c.yml' + test_tmp_yaml = Path(tmpdir) / 'test_cfg.yaml' utils.save_yaml(data={'font_mono_xs': 9}, full_path=test_tmp_yaml) d_cfg = utils.load_yaml(full_path=test_tmp_yaml)