@@ -149,7 +149,7 @@ def f_check_again():
149
149
and CI. See https://github.com/tmux-python/tmuxp/issues/310.
150
150
""" .strip ()
151
151
)
152
- def test_suppress_history (session ) :
152
+ def test_suppress_history (session : Session ) -> None :
153
153
workspace = ConfigReader ._from_file (
154
154
test_utils .get_workspace_file ("workspace/builder/suppress_history.yaml" )
155
155
)
@@ -162,10 +162,10 @@ def test_suppress_history(session):
162
162
inHistoryWindow = session .windows .get (window_name = "inHistory" )
163
163
isMissingWindow = session .windows .get (window_name = "isMissing" )
164
164
165
- def assertHistory (cmd , hist ) :
165
+ def assertHistory (cmd : str , hist : str ) -> bool :
166
166
return "inHistory" in cmd and cmd .endswith (hist )
167
167
168
- def assertIsMissing (cmd , hist ) :
168
+ def assertIsMissing (cmd : str , hist : str ) -> bool :
169
169
return "isMissing" in cmd and not cmd .endswith (hist )
170
170
171
171
for w , window_name , assertCase in [
@@ -303,8 +303,8 @@ def test_window_options_after(session: Session) -> None:
303
303
builder = WorkspaceBuilder (session_config = workspace , server = session .server )
304
304
builder .build (session = session )
305
305
306
- def assert_last_line (p , s ) :
307
- def f ():
306
+ def assert_last_line (p : Pane , s : str ) -> bool :
307
+ def f () -> bool :
308
308
pane_out = p .cmd ("capture-pane" , "-p" , "-J" ).stdout
309
309
while not pane_out [- 1 ].strip (): # delete trailing lines tmux 1.8
310
310
pane_out .pop ()
@@ -400,7 +400,9 @@ def test_environment_variables(session: Session) -> None:
400
400
has_gte_version ("3.0" ),
401
401
reason = "warnings are not needed for tmux >= 3.0" ,
402
402
)
403
- def test_environment_variables_logs (session : Session , caplog : pytest .LogCaptureFixture ):
403
+ def test_environment_variables_logs (
404
+ session : Session , caplog : pytest .LogCaptureFixture
405
+ ) -> None :
404
406
workspace = ConfigReader ._from_file (
405
407
test_utils .get_workspace_file ("workspace/builder/environment_vars.yaml" )
406
408
)
@@ -468,7 +470,7 @@ def test_automatic_rename_option(
468
470
assert w .name != "renamed_window"
469
471
470
472
def check_window_name_mismatch () -> bool :
471
- return w .name != portable_command
473
+ return bool ( w .name != portable_command )
472
474
473
475
assert retry_until (check_window_name_mismatch , 5 , interval = 0.25 )
474
476
@@ -670,7 +672,7 @@ def test_pane_order(session: Session) -> None:
670
672
# at 0 since python list.
671
673
pane_path = pane_paths [p_index - pane_base_index ]
672
674
673
- def f (pane_path : str , p : Pane ):
675
+ def f (pane_path : str , p : Pane ) -> bool :
674
676
p .refresh ()
675
677
return p .pane_current_path == pane_path
676
678
@@ -713,6 +715,7 @@ def test_before_load_throw_error_if_retcode_error(server: Server) -> None:
713
715
714
716
with temp_session (server ) as sess :
715
717
session_name = sess .name
718
+ assert session_name is not None
716
719
717
720
with pytest .raises (exc .BeforeLoadScriptError ):
718
721
builder .build (session = sess )
@@ -736,7 +739,9 @@ def test_before_load_throw_error_if_file_not_exists(server: Server) -> None:
736
739
737
740
with temp_session (server ) as session :
738
741
session_name = session .name
739
- temp_session_exists = server .has_session (session .name )
742
+
743
+ assert session_name is not None
744
+ temp_session_exists = server .has_session (session_name )
740
745
assert temp_session_exists
741
746
with pytest .raises ((exc .BeforeLoadScriptNotExists , OSError )) as excinfo :
742
747
builder .build (session = session )
@@ -985,6 +990,8 @@ def test_find_current_active_pane(
985
990
# Assign an active pane to the session
986
991
second_session = server .sessions [1 ]
987
992
first_pane_on_second_session_id = second_session .windows [0 ].panes [0 ].pane_id
993
+
994
+ assert first_pane_on_second_session_id is not None
988
995
monkeypatch .setenv ("TMUX_PANE" , first_pane_on_second_session_id )
989
996
990
997
builder = WorkspaceBuilder (session_config = workspace , server = server )
@@ -1134,7 +1141,7 @@ def test_load_workspace_enter(
1134
1141
pane = session .attached_pane
1135
1142
assert isinstance (pane , Pane )
1136
1143
1137
- def fn ():
1144
+ def fn () -> bool :
1138
1145
captured_pane = "\n " .join (pane .capture_pane ())
1139
1146
1140
1147
if should_see :
@@ -1320,11 +1327,11 @@ def test_layout_main_horizontal(session: Session) -> None:
1320
1327
assert len (window .panes ) == 3
1321
1328
main_horizontal_pane , * panes = window .panes
1322
1329
1323
- def height (p ) :
1324
- return int (p .pane_height )
1330
+ def height (p : Pane ) -> int :
1331
+ return int (p .pane_height ) if p . pane_height is not None else 0
1325
1332
1326
- def width (p ) :
1327
- return int (p .pane_width )
1333
+ def width (p : Pane ) -> int :
1334
+ return int (p .pane_width ) if p . pane_width is not None else 0
1328
1335
1329
1336
main_horizontal_pane_height = height (main_horizontal_pane )
1330
1337
pane_heights = [height (pane ) for pane in panes ]
@@ -1337,7 +1344,7 @@ def width(p):
1337
1344
), "The bottom row should be uniform height"
1338
1345
assert width (main_horizontal_pane ) > width (panes [0 ])
1339
1346
1340
- def is_almost_equal (x , y ) :
1347
+ def is_almost_equal (x : int , y : int ) -> bool :
1341
1348
return abs (x - y ) <= 1
1342
1349
1343
1350
assert is_almost_equal (height (panes [0 ]), height (panes [1 ]))
0 commit comments