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.
Completed
Push — master ( 194382...d1a5fb )
by Lambda
01:38
created

TestRunner.teardown_test_environment()   A

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
    # Python 3 have mock in unittest
4
    from unittest.mock import MagicMock
5
except ImportError:
6
    from mock import MagicMock
7
8
try:
9
    from django.test.utils import override_settings
10
except ImportError:
11
    from override_settings import override_settings
12
13
try:
14
    from unittest import skipIf
15
except ImportError:
16
    def skipIf(condition, message):
17
        def decorator(f):
18
            return None if condition else f
19
        return decorator
20
21
from django.conf import settings
22
try:
23
    from django.test.runner import DiscoverRunner as TestRunnerBase
24
except ImportError:
25
    from django.test.simple import DjangoTestSuiteRunner as TestRunnerBase
26
27
settings.TESTING = False
28
class TestRunner(TestRunnerBase):
29
    def setup_test_environment(self, **kwargs):
30
        super(TestRunner, self).setup_test_environment(**kwargs)
31
        settings.TESTING = True
32
33
    def teardown_test_environment(self, **kwargs):
34
        super(TestRunner, self).teardown_test_environment(**kwargs)
35
        settings.TESTING = False
36
37
try:
38
    from django.utils.encoding import python_2_unicode_compatible
39
except ImportError:
40
    # python_2_unicode_compatible is ported from Django 1.5
41
    def python_2_unicode_compatible(cls):
42
        # Note:
43
        #   This project does not use any unicode literal so use __str__
44
        #   as __unicode__ works fine.
45
        cls.__unicode__ = cls.__str__
46
        return cls
47