-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconftest.py
71 lines (64 loc) · 2.25 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pytest
from django.conf import settings
from dj_angles.mappers.mapper import clear_tag_map
from dj_angles.templatetags.model import clear_models
def pytest_configure():
settings.configure(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"dj_angles",
"example.book.apps.Config",
],
TEMPLATES=[
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
"tests/templates",
],
"OPTIONS": {
"builtins": [
"django_bird.templatetags.django_bird",
"dj_angles.templatetags.dj_angles",
],
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"dj_angles.template_loader.Loader",
"django_bird.loader.BirdLoader",
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
)
],
},
},
],
SECRET_KEY="this-is-a-secret",
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
MIDDLEWARE=(
"dj_angles.middleware.RequestMethodMiddleware",
"dj_angles.middleware.RequestAJAXMiddleware",
),
ANGLES={},
)
@pytest.fixture(autouse=True)
def reset_settings(settings):
# Make sure that ANGLES is empty before every test
settings.ANGLES = {}
# Clear the caches before every test
clear_tag_map()
clear_models()
# Run test
yield