From 632b6cc3668d9f3076712bfae6d035bdf5ee4f06 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 19:33:26 -0700 Subject: [PATCH] feat(e2e): sync the neutral core from kfde 7de53180 --- .../komorebi_vm/core/scenarios/placement.py | 22 ++++++++++++++++--- e2e/lib/tests/test_focus_moving.py | 18 +++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/e2e/lib/komorebi_vm/core/scenarios/placement.py b/e2e/lib/komorebi_vm/core/scenarios/placement.py index f285f3bf..76f9a8ec 100644 --- a/e2e/lib/komorebi_vm/core/scenarios/placement.py +++ b/e2e/lib/komorebi_vm/core/scenarios/placement.py @@ -44,22 +44,38 @@ def _settled(platform: Platform, title: str, count: int) -> None: platform.wait_for(lambda: platform.state().focused_title() == title, timeout=20) -def run(platform: Platform, checks: Checks) -> None: +def run(platform: Platform, checks: Checks, known_failures: dict[str, str] | None = None) -> None: """Starts the daemon with each case's rules, opens its windows one after the other, and checks the order they are in. + `known_failures` maps the description of a case to why a port is known to fail it, whether + its daemon does not start with the rules or puts the windows in another order. The case is + then recorded as a known failure, and the others run on. + Nothing else may be open: the daemon takes up every window in view, and the order would count it. The windows of a case are closed before the next one. A window is opened only after the one before is managed and has the focus, because "after the one in focus" depends on it. """ + known = known_failures or {} for description, rules, titles, want in CASES: - platform.restart_with(_config(rules)) + reason = known.get(description) + try: + platform.restart_with(_config(rules)) + except Exception as error: + if reason is None: + raise + checks.known_failure(description, False, f"{reason}; it did not start: {error}") + continue clients: list[Client] = [] for title in titles: clients.append(platform.spawn(title)) _settled(platform, title, len(clients)) got = _order(platform) - checks.check(f"{description}: {', '.join(want)} ({got})", got == want) + message = f"{description}: {', '.join(want)} ({got})" + if reason is None: + checks.check(message, got == want) + else: + checks.known_failure(message, got == want, reason) for client in clients: platform.close(client) platform.wait_for(lambda: platform.state().managed() == 0, timeout=20) diff --git a/e2e/lib/tests/test_focus_moving.py b/e2e/lib/tests/test_focus_moving.py index cc892fce..9b595b5b 100644 --- a/e2e/lib/tests/test_focus_moving.py +++ b/e2e/lib/tests/test_focus_moving.py @@ -300,3 +300,21 @@ def test_a_daemon_that_ignores_the_placement_rules_fails() -> None: checks = Checks() placement.run(platform, checks) assert checks.failed == len(placement.CASES) - 1, checks.failures + + +def test_a_case_a_port_cannot_start_is_a_known_failure_and_the_rest_run() -> None: + number = "by the number of the place, counted from 1" + + class Refuses(FakePlatform): + def restart_with(self, config: dict) -> None: + workspace = config["monitors"][0]["workspaces"][0] + if isinstance(workspace.get("initial_window_placement_rules"), int): + raise AssertionError("exited at start") + super().restart_with(config) + + platform = Refuses() + checks = Checks() + placement.run(platform, checks, {number: "an integer is not accepted"}) + assert checks.failed == 0, checks.failures + assert checks.passed == len(placement.CASES) - 1 + assert len(checks.known) == 1 and "exited at start" in checks.known[0]