From 53d43465b6c2e1270f41fed7b69d4f14b2a2bc9d Mon Sep 17 00:00:00 2001 From: Mike Rossetti Date: Tue, 29 Mar 2022 14:51:47 -0400 Subject: [PATCH] Update testing.rst Share pytest fixtures to prevent duplicate initialization. See: https://docs.pytest.org/en/6.2.x/fixture.html#scope-sharing-fixtures-across-classes-modules-packages-or-session --- docs/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index d68cb533..c892efb1 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -56,7 +56,7 @@ set up and tear down resources. import pytest from my_project import create_app - @pytest.fixture() + @pytest.fixture(scope="module") def app(): app = create_app() app.config.update({ @@ -70,12 +70,12 @@ set up and tear down resources. # clean up / reset resources here - @pytest.fixture() + @pytest.fixture(scope="module") def client(app): return app.test_client() - @pytest.fixture() + @pytest.fixture(scope="module") def runner(app): return app.test_cli_runner()