Skip to content

Commit 419f93c

Browse files
committed
test(builder[on-before-script]): Add test for on_before_script not called without script key
why: Verify callback is not fired when session config has no before_script key. what: - Add test_builder_on_before_script_not_called_without_script using real server fixture
1 parent 36fc59b commit 419f93c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/workspace/test_progress.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,24 @@ def test_builder_on_progress_callback(
3232
assert any("Creating window:" in c for c in calls)
3333
assert any("Creating pane:" in c for c in calls)
3434
assert "Workspace built" in calls
35+
36+
37+
def test_builder_on_before_script_not_called_without_script(
38+
server: Server,
39+
monkeypatch: pytest.MonkeyPatch,
40+
) -> None:
41+
"""on_before_script callback is not invoked when config has no before_script key."""
42+
monkeypatch.delenv("TMUX", raising=False)
43+
44+
session_config = {
45+
"session_name": "no-script-callback-test",
46+
"windows": [{"window_name": "main", "panes": [{"shell_command": []}]}],
47+
}
48+
called: list[bool] = []
49+
builder = WorkspaceBuilder(
50+
session_config=session_config,
51+
server=server,
52+
on_before_script=lambda: called.append(True),
53+
)
54+
builder.build()
55+
assert called == []

0 commit comments

Comments
 (0)