File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ pytest-django fixture is used to create the test database. When
349
349
``call_command `` is invoked, the test database is already prepared and
350
350
configured.
351
351
352
- Put this in conftest.py::
352
+ Put this in `` conftest.py `` ::
353
353
354
354
import pytest
355
355
@@ -359,3 +359,20 @@ Put this in conftest.py::
359
359
def django_db_setup(django_db_setup, django_db_blocker):
360
360
with django_db_blocker:
361
361
call_command('loaddata', 'your_data_fixture.json')
362
+
363
+ Use the same database for all xdist processes
364
+ """""""""""""""""""""""""""""""""""""""""""""
365
+
366
+ By default, each xdist process gets its own database to run tests on. This is
367
+ needed to have transactional tests that does not interfere with eachother.
368
+
369
+ If you instead want your tests to use the same database, override the
370
+ :fixture: `django_db_modify_db_settings ` to not do anything. Put this in
371
+ ``conftest.py ``::
372
+
373
+ import pytest
374
+
375
+
376
+ @pytest.fixture(scope='session')
377
+ def django_db_modify_db_settings():
378
+ pass
You can’t perform that action at this time.
0 commit comments