1616
1717if t .TYPE_CHECKING :
1818 from libtmux .session import Session
19+ from libtmux .window import Window
1920
2021TEST_SESSION_PREFIX = "libtmux_"
2122RETRY_TIMEOUT_SECONDS = int (os .getenv ("RETRY_TIMEOUT_SECONDS" , 8 ))
@@ -201,7 +202,7 @@ def temp_session(
201202@contextlib .contextmanager
202203def temp_window (
203204 session : "Session" , * args : t .Any , ** kwargs : t .Any
204- ) -> t .Generator ["Session " , t .Any , t .Any ]:
205+ ) -> t .Generator ["Window " , t .Any , t .Any ]:
205206 """
206207 Return a context manager with a temporary window.
207208
@@ -231,7 +232,13 @@ def temp_window(
231232 --------
232233
233234 >>> 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($... ...)))
235242 """
236243
237244 if "window_name" not in kwargs :
@@ -247,7 +254,7 @@ def temp_window(
247254 assert isinstance (window_id , str )
248255
249256 try :
250- yield session
257+ yield window
251258 finally :
252259 if session .find_where ({"window_id" : window_id }):
253260 window .kill_window ()
0 commit comments