Skip to content

Commit 223bbd1

Browse files
committed
fix,test(temp_window): Fix return type, doctest
1 parent b2ef05a commit 223bbd1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libtmux/test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
if t.TYPE_CHECKING:
1818
from libtmux.session import Session
19+
from libtmux.window import Window
1920

2021
TEST_SESSION_PREFIX = "libtmux_"
2122
RETRY_TIMEOUT_SECONDS = int(os.getenv("RETRY_TIMEOUT_SECONDS", 8))
@@ -201,7 +202,7 @@ def temp_session(
201202
@contextlib.contextmanager
202203
def 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

Comments
 (0)