Skip to content

Commit 548caa8

Browse files
committed
tests/end2end: run each test's SDoc server from its folder, unless specified otherwise
This is a cleaner approach for sandboxing the test environment and its outputs. The optional cwd= parameter is forward-looking and will be used for testing the Diff screen feature where a custom Git tree setup must be done in a temporary folder.
1 parent 34a0a7b commit 548caa8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/end2end/server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ def __init__(
8686
config_path: Optional[str] = None,
8787
port: Optional[int] = None,
8888
expectations: Optional[List] = None,
89+
cwd: Optional[str] = None,
8990
):
9091
is_parallel_execution = test_environment.is_parallel_execution
9192

9293
assert os.path.isdir(input_path)
9394
if config_path is not None:
94-
assert os.path.exists(config_path)
95+
assert os.path.exists(config_path), config_path
96+
if cwd is not None:
97+
assert os.path.isdir(cwd), cwd
98+
9599
self.path_to_tdoc_folder = input_path
96100
self.output_path: Optional[str] = output_path
97101
self.config_path: Optional[str] = config_path
@@ -123,6 +127,8 @@ def __init__(
123127
else ["INFO: Application startup complete."]
124128
)
125129

130+
self.cwd: str = cwd if cwd is not None else input_path
131+
126132
# All of these below become initialized/used starting from run()
127133
self.process = None
128134
self.log_file_out = None

0 commit comments

Comments
 (0)