Skip to content

Commit 0066c8c

Browse files
committed
tests: Handle Window.show_options scope mismatch
1 parent daa3cb6 commit 0066c8c

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
@@ -288,7 +288,10 @@ def test_set_and_show_options(session: Session) -> None:
288288

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

293296
if has_gte_version("2.3"):
294297
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
@@ -220,7 +220,7 @@ def test_window_rename(
220220
window_name_before = "test"
221221
window_name_after = "ha ha ha fjewlkjflwef"
222222

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

226226
assert window == session.active_window
@@ -306,7 +306,10 @@ def test_set_and_show_window_options(session: Session) -> None:
306306

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

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

0 commit comments

Comments
 (0)