11from xmlrunner .unittest import unittest
22
33import sys
4- import os
54from os import path , chdir , getcwd
65
76try :
1312
1413TESTS_DIR = path .dirname (__file__ )
1514
15+
1616@unittest .skipIf (django is None , 'django not found' )
1717class DjangoTest (unittest .TestCase ):
18+
1819 def setUp (self ):
1920 self ._old_cwd = getcwd ()
2021 self .project_dir = path .abspath (path .join (TESTS_DIR , 'django_example' ))
@@ -27,30 +28,30 @@ def tearDown(self):
2728 chdir (self ._old_cwd )
2829
2930 def _check_runner (self , runner ):
30- suite = runner .build_suite (test_labels = ['app2' ,'app' ])
31- test_ids = [ test .id () for test in suite ]
31+ suite = runner .build_suite (test_labels = ['app2' , 'app' ])
32+ test_ids = [test .id () for test in suite ]
3233 self .assertEqual (test_ids , [
3334 'app2.tests.DummyTestCase.test_pass' ,
3435 'app.tests.DummyTestCase.test_pass' ,
3536 ])
3637 suite = runner .build_suite (test_labels = [])
37- test_ids = [ test .id () for test in suite ]
38+ test_ids = [test .id () for test in suite ]
3839 self .assertEqual (set (test_ids ), set ([
3940 'app.tests.DummyTestCase.test_pass' ,
4041 'app2.tests.DummyTestCase.test_pass' ,
4142 ]))
4243
4344 def test_django_runner (self ):
4445 from django .conf import settings
45- settings .configure (INSTALLED_APPS = ['app' ,'app2' ])
46+ settings .configure (INSTALLED_APPS = ['app' , 'app2' ])
4647 runner_class = get_runner (settings )
4748 runner = runner_class ()
4849 self ._check_runner (runner )
4950
5051 def test_django_xmlrunner (self ):
5152 from django .conf import settings
5253 settings .configure (
53- INSTALLED_APPS = ['app' ,'app2' ],
54+ INSTALLED_APPS = ['app' , 'app2' ],
5455 TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner' )
5556 runner_class = get_runner (settings )
5657 runner = runner_class ()
0 commit comments