I have dumped data from my development environment using dumpdata django command into a yaml file.
I am using pytest framework and need to achieve the following scenario:
Is there any plugin or hook which I can use to achieve the above ?
I am using python 3.8, pytest 6.2.4, pytest-django 4.40, Django 3.0.5
If you are using the pytest-django package then you can load Django data fixtures for your tests by providing a django_db_setup fixture pytest fixture in conftest.py
import pytest
from django.core.management import call_command
@pytest.fixture(scope='session')
def django_db_setup(django_db_setup, django_db_blocker):
with django_db_blocker.unblock():
call_command('loaddata', 'my_fixture.yaml')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With