Skip to content

Commit aa61477

Browse files
committed
Test first pane start_directory
1 parent 6fc4bbe commit aa61477

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
session_name: sampleconfig
2+
windows:
3+
- panes:
4+
- start_directory: /usr
5+
- start_directory: /etc

tests/test_workspacebuilder.py

+29
Original file line numberDiff line numberDiff line change
@@ -1154,3 +1154,32 @@ def test_load_workspace_sleep(
11541154
time.sleep(0.1)
11551155
captured_pane = "\n".join(pane.capture_pane())
11561156
assert output in captured_pane
1157+
1158+
1159+
def test_first_pane_start_directory(session, tmp_path: pathlib.Path):
1160+
yaml_config = test_utils.read_config_file(
1161+
"workspacebuilder/first_pane_start_directory.yaml"
1162+
)
1163+
1164+
sconfig = kaptan.Kaptan(handler="yaml")
1165+
sconfig = sconfig.import_config(str(yaml_config)).get()
1166+
sconfig = config.expand(sconfig)
1167+
sconfig = config.trickle(sconfig)
1168+
1169+
builder = WorkspaceBuilder(sconf=sconfig)
1170+
builder.build(session=session)
1171+
1172+
assert session == builder.session
1173+
dirs = ["/usr", "/etc"]
1174+
1175+
assert session.windows
1176+
window = session.windows[0]
1177+
for path, p in zip(dirs, window.panes):
1178+
1179+
def f():
1180+
p.server._update_panes()
1181+
pane_path = p.current_path
1182+
return path in pane_path or pane_path == path
1183+
1184+
# handle case with OS X adding /private/ to /tmp/ paths
1185+
assert retry_until(f)

0 commit comments

Comments
 (0)