From a4d6acc23943759b46fa90ec68e500016b933410 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 28 May 2018 13:41:06 -0700 Subject: [PATCH] Use scope='session' for all fixtures This means they will only be executed once which makes sense since the database they create is immutable. --- tests/test_api.py | 6 +++--- tests/test_html.py | 2 +- tests/test_inspect.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 05929342..24bfbc65 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -9,9 +9,9 @@ from .fixtures import ( import pytest import urllib -pytest.fixture(scope='module')(app_client) -pytest.fixture(scope='module')(app_client_shorter_time_limit) -pytest.fixture(scope='module')(app_client_returend_rows_matches_page_size) +pytest.fixture(scope='session')(app_client) +pytest.fixture(scope='session')(app_client_shorter_time_limit) +pytest.fixture(scope='session')(app_client_returend_rows_matches_page_size) def test_homepage(app_client): diff --git a/tests/test_html.py b/tests/test_html.py index 79f3b581..cc227f7b 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -4,7 +4,7 @@ import pytest import re import urllib.parse -pytest.fixture(scope='module')(app_client) +pytest.fixture(scope='session')(app_client) def test_homepage(app_client): diff --git a/tests/test_inspect.py b/tests/test_inspect.py index 6cbfde26..954dcff7 100644 --- a/tests/test_inspect.py +++ b/tests/test_inspect.py @@ -35,7 +35,7 @@ CREATE TABLE "office" ( ''' -@pytest.fixture(scope='module') +@pytest.fixture(scope='session') def ds_instance(): with tempfile.TemporaryDirectory() as tmpdir: filepath = os.path.join(tmpdir, 'test_tables.db')