Skip to content

Commit 702dfe7

Browse files
committed
tests: Handle Window.show_options scope mismatch
1 parent 504b19e commit 702dfe7

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

294294
window.set_option("main-pane-height", 40)
295295
assert window._show_option("main-pane-height") == 40
296-
assert window._show_options()["main-pane-height"] == 40
296+
297+
# By default, show-options will session scope, even if target is a window
298+
with pytest.raises(KeyError):
299+
assert window._show_options()["main-pane-height"] == 40
297300

298301
if has_gte_version("2.3"):
299302
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
@@ -225,7 +225,7 @@ def test_window_rename(
225225
window_name_before = "test"
226226
window_name_after = "ha ha ha fjewlkjflwef"
227227

228-
session.set_option("automatic-rename", "off")
228+
session.set_option("automatic-rename", "off", scope=None)
229229
window = session.new_window(window_name=window_name_before, attach=True)
230230

231231
assert window == session.active_window
@@ -311,7 +311,10 @@ def test_set_and_show_window_options(session: Session) -> None:
311311

312312
window.set_option("main-pane-height", 40)
313313
assert window._show_option("main-pane-height") == 40
314-
assert window._show_options()["main-pane-height"] == 40
314+
315+
# By default, show-options will session scope, even if target is a window
316+
with pytest.raises(KeyError):
317+
assert window._show_options()["main-pane-height"] == 40
315318

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

0 commit comments

Comments
 (0)