From 57997a923029a62a46a9e196ff1ec06d26d60644 Mon Sep 17 00:00:00 2001 From: Sergey Golitsynskiy Date: Thu, 21 Oct 2021 22:55:51 -0400 Subject: [PATCH] Add comment to session fixture --- test/unit/data/model/mapping/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/unit/data/model/mapping/conftest.py b/test/unit/data/model/mapping/conftest.py index f18f0b53ba2..5f4ad43c8e7 100644 --- a/test/unit/data/model/mapping/conftest.py +++ b/test/unit/data/model/mapping/conftest.py @@ -11,6 +11,16 @@ def engine(): @pytest.fixture def session(init_model, engine): + """ + init_model is a fixture that must be defined in the test module using the + session fixture (or in any other discoverable location). Ideally, it will + have module scope and will initialize the models in the database. It must + use the same engine as this fixture. For example: + + @pytest.fixture(scope='module') + def init_model(engine): + model.mapper_registry.metadata.create_all(engine) + """ session_factory = sessionmaker(bind=engine) Session = scoped_session(session_factory) yield Session()