Skip to content

Commit 1441afc

Browse files
committed
Add FAQ note on automatic database access.
1 parent abc12e0 commit 1441afc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/faq.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ compatible with this approach, you need to use the standard Django methods of
103103
setting the ``DJANGO_SETTINGS_MODULE``/``DJANGO_CONFIGURATION`` environmental
104104
variables or the ``--settings`` command line option.
105105

106+
How can I give database access to all my tests without the `django_db` marker?
107+
------------------------------------------------------------------------------
108+
109+
Create an autouse fixture and put it in `conftest.py` in your project root::
110+
111+
@pytest.fixture(autouse=True)
112+
def enable_db_access_for_all_tests(db):
113+
pass
114+
106115
How/where can I get help with pytest/pytest-django?
107116
---------------------------------------------------
108117

0 commit comments

Comments
 (0)