@@ -259,6 +259,51 @@ def test_window_options(session):
259259 w .select_layout (wconf ['layout' ])
260260
261261
262+ @pytest .mark .flaky (reruns = 5 )
263+ def test_window_options_after (session ):
264+ yaml_config = loadfixture ("workspacebuilder/window_options_after.yaml" )
265+ s = session
266+ sconfig = kaptan .Kaptan (handler = 'yaml' )
267+ sconfig = sconfig .import_config (yaml_config ).get ()
268+ sconfig = config .expand (sconfig )
269+
270+ builder = WorkspaceBuilder (sconf = sconfig )
271+ builder .build (session = session )
272+
273+ def assert_last_line (p , s ):
274+ correct = False
275+ for _ in range (10 ):
276+ 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 ()
279+ if len (pane_out ) > 1 and pane_out [- 2 ].strip () == s :
280+ correct = True
281+ break
282+
283+ time .sleep (0.1 )
284+
285+ # Print output for easier debugging if assertion fails
286+ if not correct :
287+ print ('\n ' .join (pane_out ))
288+
289+ return correct
290+
291+ for i , pane in enumerate (session .attached_window .panes ):
292+ assert assert_last_line (pane , str (i )), \
293+ "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 )
298+
299+ session .cmd ('send-keys' , ' echo moo' )
300+ session .cmd ('send-keys' , 'Enter' )
301+
302+ for pane in session .attached_window .panes :
303+ assert assert_last_line (pane , 'moo' ), \
304+ "Synchronized command did not execute properly"
305+
306+
262307def test_window_shell (session ):
263308 yaml_config = loadfixture ("workspacebuilder/window_shell.yaml" )
264309 s = session
0 commit comments