Skip to content

Commit 9ba512b

Browse files
committed
unittest2 if python 2.6
1 parent a0ad3a4 commit 9ba512b

14 files changed

+59
-31
lines changed

tmuxp/testsuite/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131

3232
def suite():
33-
import unittest
33+
try:
34+
import unittest2
35+
except ImportError: # Python 2.7
36+
import unittest
3437

3538
return unittest.TestLoader().discover('.', pattern="test_*.py")

tmuxp/testsuite/helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, division, print_function, with_statement
3-
import unittest
3+
try:
4+
import unittest2
5+
except ImportError: # Python 2.7
6+
import unittest
47
import time
58
from . import t
69

tmuxp/testsuite/test_cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
import os
55
import shutil
6-
import unittest
6+
try:
7+
import unittest2
8+
except ImportError: # Python 2.7
9+
import unittest
710
import kaptan
811
import tempfile
912
from .. import config, cli
1013
from ..util import tmux
1114

12-
from .. import log
1315
import logging
1416

1517
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33

44
import os
55
import shutil
6-
import unittest
6+
try:
7+
import unittest2
8+
except ImportError: # Python 2.7
9+
import unittest
710
import kaptan
811
from .. import config, exc
912
from ..util import tmux
1013

11-
from .. import log
1214
import logging
1315

1416
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_config_teamocil.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
from __future__ import absolute_import, division, print_function, with_statement
33

44
import os
5-
import shutil
6-
import unittest
5+
try:
6+
import unittest2
7+
except ImportError: # Python 2.7
8+
import unittest
79
import kaptan
810
from .. import config, exc
911
from ..util import tmux
1012

11-
from .. import log
1213
import logging
1314

1415
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_config_tmuxinator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
from __future__ import absolute_import, division, print_function, with_statement
33

44
import os
5-
import shutil
6-
import unittest
5+
try:
6+
import unittest2
7+
except ImportError: # Python 2.7
8+
import unittest
79
import kaptan
810
from .. import config, exc
911
from ..util import tmux, basestring
1012

11-
from .. import log
1213
import logging
1314

1415
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_pane.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, division, print_function, with_statement
33

4-
import unittest
4+
try:
5+
import unittest2
6+
except ImportError: # Python 2.7
7+
import unittest
8+
59
from .helpers import TmuxTestCase
610
from . import t
711

8-
from .. import log
912
import logging
1013

1114
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, division, print_function, with_statement
33

4-
import unittest
4+
try:
5+
import unittest2
6+
except ImportError: # Python 2.7
7+
import unittest
58
from random import randint
69
from .. import Server
7-
from ..util import tmux
8-
from .helpers import TmuxTestCase, TEST_SESSION_PREFIX
10+
from .helpers import TmuxTestCase
911
from . import t
1012

11-
from .. import log
1213
import logging
1314

1415
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, division, print_function, with_statement
33

4-
import unittest
4+
try:
5+
import unittest2
6+
except ImportError: # Python 2.7
7+
import unittest
58
from random import randint
69
from time import sleep
710
from .. import Session, Window, Pane
811
from ..util import tmux
912
from .helpers import TmuxTestCase, TEST_SESSION_PREFIX
1013
from . import t
1114

12-
from .. import log
1315
import logging
1416

1517
logger = logging.getLogger(__name__)

tmuxp/testsuite/test_tmuxobject.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, division, print_function, with_statement
33

4-
import unittest
54
import random
5+
try:
6+
import unittest2
7+
except ImportError: # Python 2.7
8+
import unittest
9+
610
from .. import Pane, Window, Session
711
from .helpers import TmuxTestCase
812
from . import t
913

10-
from .. import log
1114
import logging
1215

1316
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)