Skip to content

Commit a469a15

Browse files
committed
Clean up tests/django_test.py.
1 parent 6f18f99 commit a469a15

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tests/django_test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from xmlrunner.unittest import unittest
32

43
import sys
@@ -9,9 +8,12 @@
98
import django
109
except ImportError:
1110
django = None
11+
else:
12+
from django.test.utils import get_runner
1213

1314
TESTS_DIR = path.dirname(__file__)
1415

16+
@unittest.skipIf(django is None, 'django not found')
1517
class DjangoTest(unittest.TestCase):
1618
def setUp(self):
1719
self._old_cwd = getcwd()
@@ -20,11 +22,9 @@ def setUp(self):
2022
sys.path.append(self.project_dir)
2123
import django.conf
2224
django.conf.settings = django.conf.LazySettings()
23-
# os.environ['DJANGO_SETTINGS_MODULE'] = 'django_example.settings'
2425

2526
def tearDown(self):
2627
chdir(self._old_cwd)
27-
# del os.environ['DJANGO_SETTINGS_MODULE']
2828

2929
def _check_runner(self, runner):
3030
suite = runner.build_suite(test_labels=['app2','app'])
@@ -40,22 +40,18 @@ def _check_runner(self, runner):
4040
'app2.tests.DummyTestCase.test_pass',
4141
]))
4242

43-
@unittest.skipIf(django is None, 'django not found')
4443
def test_django_runner(self):
4544
from django.conf import settings
4645
settings.configure(INSTALLED_APPS=['app','app2'])
47-
from django.test.utils import get_runner
4846
runner_class = get_runner(settings)
4947
runner = runner_class()
5048
self._check_runner(runner)
5149

52-
@unittest.skipIf(django is None, 'django not found')
5350
def test_django_xmlrunner(self):
5451
from django.conf import settings
5552
settings.configure(
5653
INSTALLED_APPS=['app','app2'],
5754
TEST_RUNNER='xmlrunner.extra.djangotestrunner.XMLTestRunner')
58-
from django.test.utils import get_runner
5955
runner_class = get_runner(settings)
6056
runner = runner_class()
6157
self._check_runner(runner)

0 commit comments

Comments
 (0)