File: conftest.py

package info (click to toggle)
python-django-dynamic-fixture 4.0.1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 616 kB
  • sloc: python: 3,909; makefile: 237; sh: 6
file content (22 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# PyTest file for global set up.

# Django initialisation
import django
django.setup()

# Give DB access to PyTests
import pytest
pytest.mark.django_db

# MonkeyPatch Django-Test teardown
from django.test import utils
original_teardown_test_environment = utils.teardown_test_environment
def fixed_teardown_test_environment():
    try:
        original_teardown_test_environment()
    except TypeError:
        # Ignore some Django or PyTest-Django bug
        pass
utils.teardown_test_environment = fixed_teardown_test_environment

print(':: PyTest conftest.py loaded.')