Skip to content

Commit a1a0bf6

Browse files
kannon92mr-c
authored andcommitted
feat: add tmp_path fixture and validate output
1 parent 9f636fc commit a1a0bf6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tests/echo-stdout-log-dir.cwl

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env cwl-runner
22
cwlVersion: v1.0
33
class: CommandLineTool
4+
id: echo
45
inputs:
56
- id: inp
67
type: string

tests/test_stdout_stderr_log_dir.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ def test_log_dir_echo_output(tmp_path: Path) -> None:
1717
# should there be an empty stderr log, though?
1818

1919

20-
def test_log_dir_echo_no_output() -> None:
20+
def test_log_dir_echo_no_output(tmp_path: Path) -> None:
2121
_, stdout, stderr = get_main_output(
2222
[
2323
"--log-dir",
24-
"logs",
24+
str(tmp_path),
2525
get_data("tests/echo-stdout-log-dir.cwl"),
2626
"--inp",
2727
"hello",
2828
]
2929
)
30-
for dir in os.listdir("logs"):
31-
for file in os.listdir(f"logs/{dir}"):
30+
for dir in os.listdir(tmp_path):
31+
for file in os.listdir(f"{tmp_path}/{dir}"):
3232
assert file == "out.txt"
33+
output = open(f"{tmp_path}/{dir}/{file}",'r').read()
34+
assert 'hello' in output

0 commit comments

Comments
 (0)