-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
runtests.py
executable file
·38 lines (29 loc) · 1.01 KB
/
runtests.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import pytest
if __name__ == '__main__':
sys.path.insert(0, 'tests')
if os.environ.get('POSTGRESQL', False):
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openwisp2.postgresql_settings')
else:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openwisp2.settings')
from django.core.management import execute_from_command_line
args = sys.argv
args.insert(1, 'test')
if not os.environ.get('SAMPLE_APP', False):
args.insert(2, 'openwisp_controller')
else:
args.insert(2, 'openwisp2')
if os.environ.get('POSTGRESQL', False):
args.extend(['--tag', 'db_tests'])
args.extend(['--tag', 'selenium_tests'])
else:
args.extend(['--exclude-tag', 'selenium_tests'])
execute_from_command_line(args)
if not os.environ.get('SAMPLE_APP', False):
app_dir = 'openwisp_controller/'
else:
app_dir = 'tests/openwisp2/'
sys.exit(pytest.main([app_dir]))