diff --git a/test/conftest.py b/test/conftest.py index 29116dc..42c6f78 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -20,6 +20,29 @@ this_module_path = sys.modules[__name__].__file__ +################################################ +# FIXTURES AUTOMATICALLY APPLIED TO EVERY TEST # +################################################ + + +@pytest.fixture(autouse=True) +def qsettings_tmp_path(tmp_path): + """ + Set the location of the config file generated by QSettings to a temporary directory + + This avoids: + - unit tests affecting the local user settings in ~/.config/.refredm.conf and vice versa + - settings spilling over between tests by having a unique settings file location in each test + (thanks to `tmp_path` creating a unique directory for each test) + """ + QSettings.setPath(QSettings.NativeFormat, QSettings.UserScope, str(tmp_path)) + + +################################## +# FIXTURES THAT CAN BE REQUESTED # +################################## + + @pytest.fixture(scope="session") def DATA_DIR(): return Path(__file__).parent / "data" @@ -86,16 +109,3 @@ def get_file_paths(self, number): return file_list return _DataServe() - - -@pytest.fixture(autouse=True) -def qsettings_tmp_path(tmp_path): - """ - Set the location of the config file generated by QSettings to a temporary directory - - This avoids: - - unit tests affecting the local user settings in ~/.config/.refredm.conf and vice versa - - settings spilling over between tests by having a unique settings file location in each test - (thanks to `tmp_path` creating a unique directory for each test) - """ - QSettings.setPath(QSettings.NativeFormat, QSettings.UserScope, str(tmp_path))