-
Notifications
You must be signed in to change notification settings - Fork 28
/
conftest.py
28 lines (21 loc) · 807 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import django
from django.conf import settings
import pytest
# We manually designate which settings we will be using in an environment variable
# This is similar to what occurs in the `manage.py`
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings")
# `pytest` automatically calls this function once when tests are run.
def pytest_configure():
settings.DEBUG = False
# If you have any test specific settings, you can declare them here,
# e.g.
# settings.PASSWORD_HASHERS = (
# 'django.contrib.auth.hashers.MD5PasswordHasher',
# )
django.setup()
# Note: In Django =< 1.6 you'll need to run this instead
# settings.configure()
@pytest.fixture(autouse=True)
def enable_db_access_for_all_tests(db): # pylint: disable=unused-argument
pass