GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

TestRunner.teardown_test_environment()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
1
# coding=utf-8
2
try:
3
    from unittest.mock import MagicMock
4
except ImportError:
5
    from mock import MagicMock
6
7
from django.test import override_settings
8
9
try:
10
    from unittest import skipIf
11
except ImportError:
12
    def skipIf(condition, message):
13
        def decorator(f):
14
            return None if condition else f
15
        return decorator
16
17
from django.conf import settings
18
try:
19
    from django.test.runner import DiscoverRunner as TestRunnerBase
20
except ImportError:
21
    from django.test.simple import DjangoTestSuiteRunner as TestRunnerBase
22
23
settings.TESTING = False
24
class TestRunner(TestRunnerBase):
25
    def setup_test_environment(self, **kwargs):
26
        super(TestRunner, self).setup_test_environment(**kwargs)
27
        settings.TESTING = True
28
29
    def teardown_test_environment(self, **kwargs):
30
        super(TestRunner, self).teardown_test_environment(**kwargs)
31
        settings.TESTING = False
32
33
try:
34
    from django.utils.encoding import python_2_unicode_compatible
35
except ImportError:
36
    # python_2_unicode_compatible is ported from Django 1.5
37
    def python_2_unicode_compatible(cls):
38
        # Note:
39
        #   This project does not use any unicode literal so use __str__
40
        #   as __unicode__ works fine.
41
        cls.__unicode__ = cls.__str__
42
        return cls
43