File tree 1 file changed +26
-6
lines changed
1 file changed +26
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import os , sys
4
4
5
- parent = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
6
- sys .path .insert (0 , parent )
5
+ from django .conf import settings
7
6
8
- os .environ ['DJANGO_SETTINGS_MODULE' ] = 'tests.test_settings'
9
7
10
- from django .test .simple import run_tests
8
+ if not settings .configured :
9
+ settings_dict = dict (
10
+ INSTALLED_APPS = ['form_utils' , 'tests' ],
11
+ DATABASES = {
12
+ "default" : {
13
+ "ENGINE" : "django.db.backends.sqlite3" ,
14
+ }
15
+ },
16
+ MEDIA_ROOT = os .path .join (os .path .dirname (__file__ ), 'media' ),
17
+ MEDIA_URL = '/media/' ,
18
+ )
11
19
12
- def runtests ():
13
- failures = run_tests (['tests' ], verbosity = 1 , interactive = True )
20
+ settings .configure (** settings_dict )
21
+
22
+
23
+ def runtests (* test_args ):
24
+ if not test_args :
25
+ test_args = ['tests' ]
26
+
27
+ parent = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
28
+ sys .path .insert (0 , parent )
29
+
30
+ from django .test .simple import DjangoTestSuiteRunner
31
+ failures = DjangoTestSuiteRunner (
32
+ verbosity = 1 , interactive = True , failfast = False ).run_tests (test_args )
14
33
sys .exit (failures )
15
34
35
+
16
36
if __name__ == '__main__' :
17
37
runtests ()
You can’t perform that action at this time.
0 commit comments