Skip to content

Commit fa8733e

Browse files
committed
tests: flake8 and tests
1 parent 68d9d89 commit fa8733e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/test_workspacebuilder.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def assertIsMissing(cmd, hist):
173173
p.cmd("send-keys", "Enter")
174174

175175
buffer_name = "test"
176+
sent_cmd = None
177+
176178
def f():
177179
# from v0.7.4 libtmux session.cmd adds target -t self.id by default
178180
# show-buffer doesn't accept -t, use global cmd.
@@ -186,8 +188,10 @@ def f():
186188
# Parse the sent and last-in-history commands
187189
sent_cmd = captured_pane.stdout[0].strip()
188190
history_cmd = captured_pane.stdout[-2].strip()
191+
p.server._update_panes()
189192

190193
return assertCase(sent_cmd, history_cmd)
194+
191195
assert retry_until(f), f"Unknown sent command: [{sent_cmd}] in {assertCase}"
192196

193197

@@ -282,6 +286,8 @@ def test_window_options_after(session):
282286
builder = WorkspaceBuilder(sconf=sconfig)
283287
builder.build(session=session)
284288

289+
pane_out = []
290+
285291
def assert_last_line(p, s):
286292
def f():
287293
pane_out = p.cmd("capture-pane", "-p", "-J").stdout
@@ -292,11 +298,8 @@ def f():
292298
# Print output for easier debugging if assertion fails
293299
if retry_until(f, raises=False):
294300
return True
295-
else:
296-
print("\n".join(pane_out))
297-
return False
298-
299-
return correct
301+
print("\n".join(pane_out))
302+
return False
300303

301304
for i, pane in enumerate(session.attached_window.panes):
302305
assert assert_last_line(
@@ -333,6 +336,7 @@ def test_window_shell(session):
333336
def f():
334337
session.server._update_windows()
335338
return w["window_name"] != "top"
339+
336340
retry_until(f)
337341

338342
assert w.name != "top"
@@ -449,6 +453,7 @@ def test_start_directory(session, tmp_path: pathlib.Path):
449453

450454
for path, window in zip(dirs, session.windows):
451455
for p in window.panes:
456+
452457
def f():
453458
p.server._update_panes()
454459
pane_path = p.current_path
@@ -499,6 +504,7 @@ def test_start_directory_relative(session, tmp_path: pathlib.Path):
499504

500505
for path, window in zip(dirs, session.windows):
501506
for p in window.panes:
507+
502508
def f():
503509
p.server._update_panes()
504510
# Handle case where directories resolve to /private/ in OSX
@@ -560,6 +566,7 @@ def test_pane_order(session):
560566
def f():
561567
p.server._update_panes()
562568
return p.current_path == pane_path
569+
563570
retry_until(f)
564571

565572
assert p.current_path, pane_path

0 commit comments

Comments
 (0)