-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconftest.py
47 lines (39 loc) · 1.22 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
import os
import pytest
def pytest_configure():
""" pytest setup. """
import django
from django.conf import settings
settings.configure(
DEBUG=False,
DEBUG_PROPAGATE_EXCEPTIONS=True,
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'}},
SECRET_KEY='not very secret in tests',
USE_I18N=True,
USE_L10N=True,
STATIC_URL='/static/',
ROOT_URLCONF='tests.urls',
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
),
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
),
)
if django.get_version() >= '1.7':
django.setup()
@pytest.fixture
def pdf_file_sample():
""" pytest fixture to get sample pdf file and run tests. """
return os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'tests',
'data',
'sample.pdf'
)