|
8 | 8 |
|
9 | 9 | from libtmux import exc
|
10 | 10 | from libtmux.common import has_gte_version, has_lt_version
|
| 11 | +from libtmux.constants import OptionScope |
11 | 12 | from libtmux.pane import Pane
|
12 | 13 | from libtmux.server import Server
|
13 | 14 | from libtmux.session import Session
|
@@ -232,18 +233,37 @@ def test_set_and_show_options(session: Session) -> None:
|
232 | 233 | window = session.new_window(window_name="test_window")
|
233 | 234 |
|
234 | 235 | window.set_option("main-pane-height", 20)
|
235 |
| - assert window.show_option("main-pane-height") == 20 |
| 236 | + if has_gte_version("3.0"): |
| 237 | + assert window.show_option("main-pane-height") == 20 |
| 238 | + else: |
| 239 | + assert window.show_option("main-pane-height", scope=OptionScope.Window) == 20 |
236 | 240 |
|
237 | 241 | window.set_option("main-pane-height", 40)
|
238 |
| - assert window.show_option("main-pane-height") == 40 |
| 242 | + |
| 243 | + if has_gte_version("3.0"): |
| 244 | + assert window.show_option("main-pane-height") == 40 |
| 245 | + else: |
| 246 | + assert window.show_option("main-pane-height", scope=OptionScope.Window) == 40 |
239 | 247 |
|
240 | 248 | # By default, show-options will session scope, even if target is a window
|
241 | 249 | with pytest.raises(KeyError):
|
242 | 250 | assert window.show_options()["main-pane-height"] == 40
|
243 | 251 |
|
| 252 | + if has_gte_version("3.0"): |
| 253 | + assert window.show_option("main-pane-height") == 40 |
| 254 | + else: |
| 255 | + assert window.show_option("main-pane-height", scope=OptionScope.Window) == 40 |
| 256 | + |
244 | 257 | if has_gte_version("2.3"):
|
245 | 258 | window.set_option("pane-border-format", " #P ")
|
246 |
| - assert window.show_option("pane-border-format") == " #P " |
| 259 | + |
| 260 | + if has_gte_version("3.0"): |
| 261 | + assert window.show_option("pane-border-format") == " #P " |
| 262 | + else: |
| 263 | + assert ( |
| 264 | + window.show_option("pane-border-format", scope=OptionScope.Window) |
| 265 | + == " #P " |
| 266 | + ) |
247 | 267 |
|
248 | 268 |
|
249 | 269 | def test_empty_window_option_returns_None(session: Session) -> None:
|
|
0 commit comments