Skip to content

Commit 03e6406

Browse files
committed
More test fixes. python 2.6 still having issues.
1 parent 17df006 commit 03e6406

File tree

3 files changed

+24
-37
lines changed

3 files changed

+24
-37
lines changed

run_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
def main(verbosity=2, failfast=False):
2424
"""Run TestSuite in new tmux session. Exit with code 0 if success."""
2525

26-
session_name = 'tmuxp'
27-
t.tmux('new-session', '-d', '-s', session_name)
26+
#session_name = 'tmuxp'
27+
#t.tmux('new-session', '-d', '-s', session_name)
2828
suites = unittest.TestLoader().discover('tmuxp.testsuite', pattern="*.py")
2929
result = unittest.TextTestRunner(
3030
verbosity=verbosity, failfast=failfast).run(suites)

tmuxp/testsuite/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
tmuxp.tests
4-
~~~~~~~~~~~
2+
"""Tests for tmuxp.
3+
4+
tmuxp.tests
5+
~~~~~~~~~~~
56
6-
:copyright: Copyright 2013 Tony Narlock.
7-
:license: BSD, see LICENSE for details
7+
:copyright: Copyright 2013 Tony Narlock.
8+
:license: BSD, see LICENSE for details
89
910
"""
1011

@@ -30,6 +31,7 @@
3031

3132

3233
def suite():
34+
"""Return TestSuite."""
3335
try:
3436
import unittest2 as unittest
3537
except ImportError: # Python 2.7

tmuxp/testsuite/helpers.py

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ def bootstrap():
4747
# assert session_list == t.sessions
4848

4949
TEST_SESSION_NAME = TEST_SESSION_PREFIX + str(randint(0, 13370))
50-
session = t.new_session(
51-
session_name=TEST_SESSION_NAME,
52-
)
50+
try:
51+
session = t.new_session(
52+
session_name=TEST_SESSION_NAME,
53+
)
54+
except exc.TmuxpException as e:
55+
raise e
5356

5457
'''
5558
Make sure that tmuxp can :ref:`test_builder_visually` and switches to the
@@ -58,7 +61,7 @@ def bootstrap():
5861
try:
5962
t.switch_client(session.get('session_id'))
6063
pass
61-
except Exception:
64+
except exc.TmuxpException as e:
6265
#t.attach_session(session.get('session_id'))
6366
pass
6467

@@ -74,35 +77,17 @@ def bootstrap():
7477

7578
class TmuxTestCase(unittest.TestCase):
7679

77-
'''
78-
self.session
79-
Session object
80-
self.TEST_SESSION_NAME
81-
string. name of the test case session.
82-
'''
80+
"""TmuxTestCase class, wraps the TestCase in a :class:`Session`."""
8381

84-
@classmethod
85-
def setUpClass(cls):
86-
cls.TEST_SESSION_NAME, cls.session = bootstrap()
82+
#: :class:`Session` object.
83+
# session = None
84+
#: Session name for the TestCase.
85+
# TEST_SESSION_NAME = None
8786

8887
@classmethod
89-
def setUpClassa(cls):
88+
def setUpClass(cls):
89+
"""Add :attr:`~.TEST_SESSION_NAME` and :attr:`~.session`."""
9090
try:
91-
#t.tmux('kill-server')
92-
9391
cls.TEST_SESSION_NAME, cls.session = bootstrap()
94-
# except TmuxNoClientsRunning:
95-
# logger.error('test: TmuxNoClientsRunning')
96-
# cls.TEST_SESSION_NAME, cls.session = bootstrap()
9792
except Exception as e:
98-
import traceback
99-
logger.error(e)
100-
101-
logger.error(traceback.print_exc())
102-
# raise exc.TmuxpException(e)
103-
return
104-
105-
@classmethod
106-
def tearDownClass(cls):
107-
#t.tmux('kill-server')
108-
pass
93+
raise e

0 commit comments

Comments
 (0)