Commit 42531387ca2d70c4eb254743ec9ae86ea3a43d94
1 parent
2527d246
Exists in
master
and in
39 other branches
Moved test settings out of the package
Showing
9 changed files
with
74 additions
and
69 deletions
Show diff stats
.gitignore
.travis.yml
colab/tests/__init__.py
colab/tests/settings.py
... | ... | @@ -1,38 +0,0 @@ |
1 | -from ..settings import * # noqa | |
2 | - | |
3 | - | |
4 | -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' | |
5 | - | |
6 | -LOGGING = { | |
7 | - 'version': 1, | |
8 | - | |
9 | - 'handlers': { | |
10 | - 'null': { | |
11 | - 'level': 'DEBUG', | |
12 | - 'class': 'logging.NullHandler', | |
13 | - }, | |
14 | - }, | |
15 | - | |
16 | - 'loggers': { | |
17 | - 'colab.mailman': { | |
18 | - 'handlers': ['null'], | |
19 | - 'propagate': False, | |
20 | - }, | |
21 | - 'haystack': { | |
22 | - 'handlers': ['null'], | |
23 | - 'propagate': False, | |
24 | - }, | |
25 | - 'pysolr': { | |
26 | - 'handlers': ['null'], | |
27 | - 'propagate': False, | |
28 | - }, | |
29 | - }, | |
30 | -} | |
31 | - | |
32 | -import os | |
33 | -HAYSTACK_CONNECTIONS = { | |
34 | - 'default': { | |
35 | - 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', | |
36 | - 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'), | |
37 | - }, | |
38 | -} |
runtests.py
... | ... | @@ -1,29 +0,0 @@ |
1 | -#!/usr/bin/env python | |
2 | - | |
3 | -import os | |
4 | -import sys | |
5 | - | |
6 | -os.environ['DJANGO_SETTINGS_MODULE'] = 'colab.tests.settings' | |
7 | -os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' | |
8 | -os.environ['REUSE_DB'] = '0' | |
9 | - | |
10 | -import django | |
11 | -import coverage | |
12 | - | |
13 | -from django.test.utils import get_runner | |
14 | -from django.conf import settings | |
15 | - | |
16 | - | |
17 | -def runtests(): | |
18 | - if django.VERSION >= (1, 7, 0): | |
19 | - django.setup() | |
20 | - test_runner = get_runner(settings) | |
21 | - failures = test_runner(interactive=False, failfast=False).run_tests([]) | |
22 | - sys.exit(failures) | |
23 | - | |
24 | - | |
25 | -if __name__ == '__main__': | |
26 | - if os.path.exists('.coverage'): | |
27 | - os.remove('.coverage') | |
28 | - coverage.process_startup() | |
29 | - runtests() |
setup.py
... | ... | @@ -0,0 +1,33 @@ |
1 | +#!/usr/bin/env python | |
2 | + | |
3 | +import os | |
4 | +import sys | |
5 | + | |
6 | +os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' | |
7 | +os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' | |
8 | +os.environ['REUSE_DB'] = '0' | |
9 | + | |
10 | +import django | |
11 | +import coverage | |
12 | + | |
13 | +from django.test.utils import get_runner | |
14 | +from django.conf import settings | |
15 | + | |
16 | + | |
17 | +def runtests(): | |
18 | + if django.VERSION >= (1, 7, 0): | |
19 | + django.setup() | |
20 | + test_runner = get_runner(settings) | |
21 | + failures = test_runner(interactive=False, failfast=False).run_tests([]) | |
22 | + sys.exit(failures) | |
23 | + | |
24 | + | |
25 | +def run_with_coverage(): | |
26 | + if os.path.exists('.coverage'): | |
27 | + os.remove('.coverage') | |
28 | + coverage.process_startup() | |
29 | + runtests() | |
30 | + | |
31 | + | |
32 | +if __name__ == '__main__': | |
33 | + runtests_with_coverage() | ... | ... |
... | ... | @@ -0,0 +1,38 @@ |
1 | +from colab.settings import * # noqa | |
2 | + | |
3 | + | |
4 | +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' | |
5 | + | |
6 | +LOGGING = { | |
7 | + 'version': 1, | |
8 | + | |
9 | + 'handlers': { | |
10 | + 'null': { | |
11 | + 'level': 'DEBUG', | |
12 | + 'class': 'logging.NullHandler', | |
13 | + }, | |
14 | + }, | |
15 | + | |
16 | + 'loggers': { | |
17 | + 'colab.mailman': { | |
18 | + 'handlers': ['null'], | |
19 | + 'propagate': False, | |
20 | + }, | |
21 | + 'haystack': { | |
22 | + 'handlers': ['null'], | |
23 | + 'propagate': False, | |
24 | + }, | |
25 | + 'pysolr': { | |
26 | + 'handlers': ['null'], | |
27 | + 'propagate': False, | |
28 | + }, | |
29 | + }, | |
30 | +} | |
31 | + | |
32 | +import os | |
33 | +HAYSTACK_CONNECTIONS = { | |
34 | + 'default': { | |
35 | + 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', | |
36 | + 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'), | |
37 | + }, | |
38 | +} | ... | ... |