16
16
17
17
if t .TYPE_CHECKING :
18
18
from libtmux .session import Session
19
+ from libtmux .window import Window
19
20
20
21
TEST_SESSION_PREFIX = "libtmux_"
21
22
RETRY_TIMEOUT_SECONDS = int (os .getenv ("RETRY_TIMEOUT_SECONDS" , 8 ))
@@ -201,7 +202,7 @@ def temp_session(
201
202
@contextlib .contextmanager
202
203
def temp_window (
203
204
session : "Session" , * args : t .Any , ** kwargs : t .Any
204
- ) -> t .Generator ["Session " , t .Any , t .Any ]:
205
+ ) -> t .Generator ["Window " , t .Any , t .Any ]:
205
206
"""
206
207
Return a context manager with a temporary window.
207
208
@@ -231,7 +232,13 @@ def temp_window(
231
232
--------
232
233
233
234
>>> with temp_window(session) as window:
234
- ... my_pane = window.split_window()
235
+ ... window
236
+ Window(@... ...:..., Session($... ...))
237
+
238
+
239
+ >>> with temp_window(session) as window:
240
+ ... window.split_window()
241
+ Pane(%... Window(@... ...:..., Session($... ...)))
235
242
"""
236
243
237
244
if "window_name" not in kwargs :
@@ -247,7 +254,7 @@ def temp_window(
247
254
assert isinstance (window_id , str )
248
255
249
256
try :
250
- yield session
257
+ yield window
251
258
finally :
252
259
if session .find_where ({"window_id" : window_id }):
253
260
window .kill_window ()
0 commit comments