Skip to content

Commit 656bc56

Browse files
committed
tests: Handle Window.show_options scope mismatch
1 parent d9d5f62 commit 656bc56

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/legacy_api/test_window.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ def test_set_and_show_options(session: Session) -> None:
289289

290290
window.set_option("main-pane-height", 40)
291291
assert window._show_option("main-pane-height") == 40
292-
assert window._show_options()["main-pane-height"] == 40
292+
293+
# By default, show-options will session scope, even if target is a window
294+
with pytest.raises(KeyError):
295+
assert window._show_options()["main-pane-height"] == 40
293296

294297
if has_gte_version("2.3"):
295298
window.set_option("pane-border-format", " #P ")

tests/test_window.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_window_rename(
221221
window_name_before = "test"
222222
window_name_after = "ha ha ha fjewlkjflwef"
223223

224-
session.set_option("automatic-rename", "off")
224+
session.set_option("automatic-rename", "off", scope=None)
225225
window = session.new_window(window_name=window_name_before, attach=True)
226226

227227
assert window == session.active_window
@@ -307,7 +307,10 @@ def test_set_and_show_window_options(session: Session) -> None:
307307

308308
window.set_option("main-pane-height", 40)
309309
assert window._show_option("main-pane-height") == 40
310-
assert window._show_options()["main-pane-height"] == 40
310+
311+
# By default, show-options will session scope, even if target is a window
312+
with pytest.raises(KeyError):
313+
assert window._show_options()["main-pane-height"] == 40
311314

312315
if has_gte_version("2.3"):
313316
window.set_option("pane-border-format", " #P ")

0 commit comments

Comments
 (0)