Skip to content

Commit fe27205

Browse files
committed
Stop loading unittest(2) during normal operation
On my system with CPython 2.7.3 it saves 1.1 MB of memory and 60 imports when importing raven.handlers.logging
1 parent f3885f8 commit fe27205

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

raven/utils/compat.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,3 @@
4646
from urllib import parse as _urlparse # NOQA
4747

4848
urlparse = _urlparse
49-
50-
try:
51-
from unittest2 import TestCase
52-
except ImportError:
53-
from unittest import TestCase # NOQA

raven/utils/testutils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
from exam import Exam
1111

12-
from .compat import TestCase as BaseTestCase
12+
try:
13+
from unittest2 import TestCase as BaseTestCase
14+
except ImportError:
15+
from unittest import TestCase as BaseTestCase # NOQA
1316

1417

1518
class TestCase(Exam, BaseTestCase):

tests/functional/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33

44
from subprocess import call
5-
from raven.utils.compat import TestCase
5+
from raven.utils.testutils import BaseTestCase as TestCase
66

77

88
ROOT = os.path.normpath(

0 commit comments

Comments
 (0)