Skip to content

Commit a9ad62b

Browse files
committed
add tests for pane-border-format, pep8
1 parent ccbcec7 commit a9ad62b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tests/test_workspacebuilder.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from . import fixtures_dir
1414
from libtmux import Window
15+
from libtmux.common import has_gte_version
1516
from libtmux.test import temp_session
1617
from tmuxp import config, exc
1718
from tmuxp._compat import text_type
@@ -242,6 +243,9 @@ def test_window_options(session):
242243
sconfig = sconfig.import_config(yaml_config).get()
243244
sconfig = config.expand(sconfig)
244245

246+
if has_gte_version('2.3'):
247+
sconfig['windows'][0]['options']['pane-border-format'] = ' #P '
248+
245249
builder = WorkspaceBuilder(sconf=sconfig)
246250

247251
window_count = len(session._windows) # current window count
@@ -253,6 +257,8 @@ def test_window_options(session):
253257
assert len(s._windows) == window_count
254258
assert isinstance(w, Window)
255259
assert w.show_window_option('main-pane-height') == 5
260+
if has_gte_version('2.3'):
261+
assert w.show_window_option('pane-border-format') == ' #P '
256262

257263
assert len(s._windows) == window_count
258264
window_count += 1
@@ -262,7 +268,6 @@ def test_window_options(session):
262268
@pytest.mark.flaky(reruns=5)
263269
def test_window_options_after(session):
264270
yaml_config = loadfixture("workspacebuilder/window_options_after.yaml")
265-
s = session
266271
sconfig = kaptan.Kaptan(handler='yaml')
267272
sconfig = sconfig.import_config(yaml_config).get()
268273
sconfig = config.expand(sconfig)
@@ -274,8 +279,8 @@ def assert_last_line(p, s):
274279
correct = False
275280
for _ in range(10):
276281
pane_out = p.cmd('capture-pane', '-p', '-J').stdout
277-
# delete trailing empty lines for tmux 1.8...
278-
while not pane_out[-1].strip(): pane_out.pop()
282+
while not pane_out[-1].strip(): # delete trailing lines tmux 1.8
283+
pane_out.pop()
279284
if len(pane_out) > 1 and pane_out[-2].strip() == s:
280285
correct = True
281286
break
@@ -291,10 +296,11 @@ def assert_last_line(p, s):
291296
for i, pane in enumerate(session.attached_window.panes):
292297
assert assert_last_line(pane, str(i)), \
293298
"Initial command did not execute properly/" + str(i)
294-
pane.cmd('send-keys', 'Up') # Will repeat echo
295-
pane.enter() # in each iteration
296-
assert assert_last_line(pane, str(i)), \
297-
"Repeated command did not execute properly/" + str(i)
299+
pane.cmd('send-keys', 'Up') # Will repeat echo
300+
pane.enter() # in each iteration
301+
assert assert_last_line(pane, str(i)), (
302+
"Repeated command did not execute properly/" + str(i)
303+
)
298304

299305
session.cmd('send-keys', ' echo moo')
300306
session.cmd('send-keys', 'Enter')

0 commit comments

Comments
 (0)