Skip to content

Commit

Permalink
!squash test workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Sep 10, 2022
1 parent e3423be commit d220074
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions tests/test_workspacebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,15 +1223,42 @@ def is_almost_equal(x, y):
assert is_almost_equal(width(panes[0]), width(panes[1]))


@pytest.mark.skipif(has_lt_version("2.9"), reason="default-size only applies there")
class DefaultSizeNamespaceFixture(t.NamedTuple):
test_id: str
TMUXP_DEFAULT_SIZE: t.Optional[str]
raises: bool
confoverrides: t.Dict[str, t.Any]


DEFAULT_SIZE_FIXTURES = [
DefaultSizeNamespaceFixture(
test_id="v1.13.1 default-size-breaks",
TMUXP_DEFAULT_SIZE=None,
raises=True,
confoverrides={},
),
DefaultSizeNamespaceFixture(
test_id="v1.13.1-option-workaround",
TMUXP_DEFAULT_SIZE=None,
raises=False,
confoverrides={"options": {"default-size": "800x600"}},
),
]


@pytest.mark.parametrize(
"TMUXP_DEFAULT_SIZE,raises", [[None, True], ["800x600", False]]
DefaultSizeNamespaceFixture._fields,
DEFAULT_SIZE_FIXTURES,
ids=[f.test_id for f in DEFAULT_SIZE_FIXTURES],
)
@pytest.mark.skipif(has_lt_version("2.9"), reason="default-size only applies there")
def test_issue_800_default_size_many_windows(
server: "Server",
monkeypatch: pytest.MonkeyPatch,
test_id: str,
TMUXP_DEFAULT_SIZE: t.Optional[str],
raises: bool,
confoverrides: t.Dict[str, t.Any],
) -> None:
"""Recreate default-size issue.
Expand All @@ -1248,6 +1275,10 @@ def test_issue_800_default_size_many_windows(
sconfig = config.expand(sconfig)
sconfig = config.trickle(sconfig)

if isinstance(confoverrides, dict):
for k, v in confoverrides.items():
sconfig[k] = v

if TMUXP_DEFAULT_SIZE is not None:
monkeypatch.setenv("TMUXP_DEFAULT_SIZE", TMUXP_DEFAULT_SIZE)

Expand Down

0 comments on commit d220074

Please sign in to comment.