Skip to content

Commit 2079cd1

Browse files
committed
fix tests.
Though I'm not sure if this is the right fix.
1 parent adadab5 commit 2079cd1

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

tmuxp/testsuite/workspacebuilder.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,7 @@ def test_window_shell(self):
277277

278278
for w, wconf in builder.iter_create_windows(s):
279279
if 'window_shell' in wconf:
280-
# I was having trouble testing this. I would hit an error in
281-
# util.py that stdout and stderr were being called before
282-
# assignment. I'm not sure how to handle this and I put a note
283-
# in util.py as well.
284-
285-
#self.assertEqual(wconf['window_shell'], text_type('test_command'))
286-
pass
280+
self.assertEqual(wconf['window_shell'], text_type('test_command'))
287281

288282

289283
class EnvironmentVariables(TmuxTestCase):

tmuxp/util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ def __init__(self, *args, **kwargs):
101101
e
102102
)
103103
)
104-
# Should this exit at this point?
105-
106104

107105
self.stdout = console_to_str(stdout)
108106
self.stdout = self.stdout.split('\n')

tmuxp/window.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ def by(val, *args):
6262
return False
6363
return True
6464

65-
return list(filter(by, self.server._windows))[0]
65+
ret = list(filter(by, self.server._windows))
66+
# If a window_shell option was configured which results in
67+
# a short-lived process, the window id is @0. Use that instead of
68+
# self._window_id
69+
if len(ret) == 0 and self.server._windows[0]['window_id'] == '@0':
70+
ret = self.server._windows
71+
return ret[0]
6672

6773
def cmd(self, cmd, *args, **kwargs):
6874
"""Return :meth:`Server.cmd` defaulting ``target_window`` as target.

0 commit comments

Comments
 (0)