Solution:
import pytest
@pytest.mark.django_db
class TestExample:
def test_one():
...
Assume that you’ve created a TestExample
class inside your test file and it should be decorated with @pytest.mark.django_db
. It should solve your problem.