-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests.py
More file actions
29 lines (21 loc) · 777 Bytes
/
run_tests.py
File metadata and controls
29 lines (21 loc) · 777 Bytes
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
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
from django.test.runner import DiscoverRunner
from dotenv import load_dotenv
load_dotenv()
class NoDbTestRunner(DiscoverRunner):
""" A test runner to test without database creation """
def setup_databases(self, **kwargs):
""" Override the database creation defined in parent class """
pass
def teardown_databases(self, old_config, **kwargs):
""" Override the database teardown defined in parent class """
pass
if __name__ == "__main__":
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner(keepdb=True)
failures = test_runner.run_tests(["{{ project_name }}"])
sys.exit(bool(failures))