Skip to content

Commit a0ad3a4

Browse files
committed
Create new session in TestCase bootstrap if no base session exists. See if this fixes setup.py test for travis
1 parent 3702f94 commit a0ad3a4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tmuxp/testsuite/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,4 @@
3232
def suite():
3333
import unittest
3434

35-
session_name = 'tmuxp'
36-
t.tmux('new-session', '-d', '-s', session_name)
37-
3835
return unittest.TestLoader().discover('.', pattern="test_*.py")

tmuxp/testsuite/helpers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def bootstrap():
2727
2828
'''
2929

30+
session_name = 'tmuxp'
31+
if not t.has_session(session_name):
32+
t.tmux('new-session', '-d', '-s', session_name)
33+
3034
# find current sessions prefixed with tmuxp
3135
old_test_sessions = [s.get('session_name') for s in t._sessions
3236
if
@@ -52,7 +56,7 @@ def bootstrap():
5256
t.switch_client(session.get('session_id'))
5357
pass
5458
except Exception:
55-
# t.attach_session(session.get('session_id'))
59+
#t.attach_session(session.get('session_id'))
5660
pass
5761

5862
for old_test_session in old_test_sessions:
@@ -74,11 +78,12 @@ class TmuxTestCase(unittest.TestCase):
7478
string. name of the test case session.
7579
'''
7680

77-
def setup(self):
78-
pass
79-
8081
@classmethod
8182
def setUpClass(cls):
83+
cls.TEST_SESSION_NAME, cls.session = bootstrap()
84+
85+
@classmethod
86+
def setUpClassa(cls):
8287
try:
8388
#t.tmux('kill-server')
8489

0 commit comments

Comments
 (0)