diff options
-rw-r--r-- | tests/conftest.py | 9 | ||||
-rw-r--r-- | tests/playwright/conftest.py | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index a4366ab..94f795a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,11 +28,14 @@ def ini_file(request): # potentially grab this path from a pytest option return os.path.abspath(request.config.option.ini or 'testing.ini') -@pytest.fixture(scope='session') +# Even though the ini file is scoped to session, we scope the actual settings +# to module only. This way, we can test different configurations in different +# modules. +@pytest.fixture(scope='module') def app_settings(ini_file): return get_appsettings(ini_file) -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def dbengine(app_settings, ini_file): engine = models.get_engine(app_settings) @@ -73,7 +76,7 @@ def _cleanup_data(app_settings): if (data_dir / "tracks").is_dir(): shutil.rmtree(data_dir / "tracks") -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def app(app_settings, dbengine, tmp_path_factory): app_settings["fietsboek.data_dir"] = str(tmp_path_factory.mktemp("data")) logging.getLogger().setLevel(logging.DEBUG) diff --git a/tests/playwright/conftest.py b/tests/playwright/conftest.py index 12a0047..4e7f5a4 100644 --- a/tests/playwright/conftest.py +++ b/tests/playwright/conftest.py @@ -15,7 +15,7 @@ from fietsboek.config import Config import pytest -@pytest.fixture(scope="session") +@pytest.fixture(scope="module") def server_port(): """Return a (likely) free port. @@ -29,7 +29,7 @@ def server_port(): return port -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(scope="module", autouse=True) def running_server(server_port, app): """Have the app running as an actual server.""" server = simple_server.make_server("127.0.0.1", server_port, app) |