@@ -415,15 +415,20 @@ def test_environment_variables_logs(session: Session, caplog: pytest.LogCaptureF
415
415
sum (
416
416
1
417
417
for record in caplog .records
418
- if ' Cannot set environment for new panes and windows.' in record .msg
418
+ if " Cannot set environment for new panes and windows." in record .msg
419
419
)
420
420
# From both_overrides_in_first_pane.
421
421
== 1
422
422
)
423
423
424
424
425
- def test_automatic_rename_option (session ) :
425
+ def test_automatic_rename_option (server , monkeypatch : pytest . MonkeyPatch ) -> None :
426
426
"""With option automatic-rename: on."""
427
+ # monkeypatch.delenv("DISABLE_AUTO_TITLE", raising=False)
428
+ # monkeypatch.setenv("DISABLE_AUTO_TITLE", "true")
429
+ # monkeypatch.setenv("DISABLE_AUTO_TITLE", "false")
430
+ # monkeypatch.setenv("SHELL", "bash")
431
+
427
432
workspace = ConfigReader ._from_file (
428
433
test_utils .get_workspace_file ("workspace/builder/window_automatic_rename.yaml" )
429
434
)
@@ -434,42 +439,31 @@ def test_automatic_rename_option(session):
434
439
if " " in portable_command :
435
440
portable_command = portable_command .split (" " )[0 ]
436
441
437
- builder = WorkspaceBuilder (sconf = workspace )
438
-
439
- window_count = len (session ._windows ) # current window count
440
- assert len (session ._windows ) == window_count
441
- for w , wconf in builder .iter_create_windows (session ):
442
-
443
- for p in builder .iter_create_panes (w , wconf ):
444
- w .select_layout ("tiled" ) # fix glitch with pane size
445
- p = p
446
- assert len (session ._windows ), window_count
447
- assert isinstance (w , Window )
448
- assert w .show_window_option ("automatic-rename" ) == "on"
449
-
450
- assert len (session ._windows ) == window_count
451
-
452
- window_count += 1
453
- w .select_layout (wconf ["layout" ])
442
+ builder = WorkspaceBuilder (sconf = workspace , server = server )
443
+ builder .build ()
444
+ session : Session = builder .session
445
+ w : Window = session .windows [0 ]
446
+ assert len (session .windows ) == 1
454
447
455
- assert session .name != "tmuxp"
456
- w = session .windows [0 ]
448
+ assert w .name != "renamed_window"
457
449
458
450
def check_window_name_mismatch () -> bool :
459
- session .server ._update_windows ()
451
+ w .server ._update_windows ()
460
452
return w .name != portable_command
461
453
462
- assert retry_until (check_window_name_mismatch , 2 , interval = 0.25 )
454
+ assert retry_until (check_window_name_mismatch , 5 , interval = 0.25 )
463
455
464
456
pane_base_index = w .show_window_option ("pane-base-index" , g = True )
465
- w .select_pane (pane_base_index )
466
457
467
458
def check_window_name_match () -> bool :
468
- session .server ._update_windows ()
469
- return w .name == portable_command
459
+ w .server ._update_windows ()
460
+ assert w .show_window_option ("automatic-rename" ) == "on"
461
+
462
+ print (f"w.name: { w .name } and portable_command: { portable_command } " )
463
+ return w .name == "zsh"
470
464
471
465
assert retry_until (
472
- check_window_name_match , 2 , interval = 0.25
466
+ check_window_name_match , 4 , interval = 0.05
473
467
), f"Window name { w .name } should be { portable_command } "
474
468
475
469
w .select_pane ("-D" )
0 commit comments