Skip to content

Commit f1e2f31

Browse files
committed
Only import unittest2 if Python is < 2.7
See also: celery/case#1
1 parent d0e8964 commit f1e2f31

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

tmuxp/testsuite/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
import pkgutil
1313
import sys
1414

15-
try:
16-
import unittest2 as unittest
17-
except ImportError: # Python 2.7
18-
import unittest
19-
2015
from tmuxp import log
2116
from tmuxp._compat import string_types, PY2, reraise
2217
from tmuxp.server import Server
2318

19+
if sys.version_info < (2, 7):
20+
import unittest2 as unittest
21+
else:
22+
import unittest
23+
2424
t = Server()
2525
t.socket_name = 'tmuxp_test'
2626

tmuxp/testsuite/helpers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
from tmuxp import exc
2222
from tmuxp.testsuite import t
2323

24-
try:
24+
if sys.version_info < (2, 7):
2525
import unittest2 as unittest
26-
except ImportError: # Python 2.7
26+
else:
2727
import unittest
2828

29-
3029
logger = logging.getLogger(__name__)
3130

3231
TEST_SESSION_PREFIX = 'test tmuxp_'

0 commit comments

Comments
 (0)