forked from getsentry/sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
70 lines (60 loc) · 2.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from django.conf import settings
import os
import os.path
def pytest_configure(config):
import warnings
warnings.filterwarnings('error', '', Warning, r'(sentry|raven)')
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].update({
'ENGINE': 'django.db.backends.mysql',
'NAME': 'sentry',
'USER': 'root',
})
elif test_db == 'postgres':
settings.DATABASES['default'].update({
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'NAME': 'sentry',
'OPTIONS': {
'autocommit': True,
}
})
elif test_db == 'sqlite':
settings.DATABASES['default'].update({
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
})
# http://djangosnippets.org/snippets/646/
class InvalidVarException(object):
def __mod__(self, missing):
try:
missing_str = unicode(missing)
except:
missing_str = 'Failed to create string representation'
raise Exception('Unknown template variable %r %s' % (missing, missing_str))
def __contains__(self, search):
if search == '%s':
return True
return False
settings.TEMPLATE_DEBUG = True
# settings.TEMPLATE_STRING_IF_INVALID = InvalidVarException()
# Disable static compiling in tests
settings.STATIC_BUNDLES = {}
# override a few things with our test specifics
settings.INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + (
'tests',
)
# Need a predictable key for tests that involve checking signatures
settings.SENTRY_KEY = 'abc123'
settings.SENTRY_PUBLIC = False
# This speeds up the tests considerably, pbkdf2 is by design, slow.
settings.PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
# enable draft features
settings.SENTRY_ENABLE_EXPLORE_CODE = True
settings.SENTRY_ENABLE_EXPLORE_USERS = True
settings.SENTRY_ENABLE_EMAIL_REPLIES = True