Skip to content

Commit 4984ab1

Browse files
committed
improve test failure reporting
1 parent 265e6d3 commit 4984ab1

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

tests/test_examples.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,7 @@ def test_cid_file_w_prefix(tmp_path: Path, factor: str) -> None:
11811181
error_code, stdout, stderr = get_main_output(commands)
11821182
finally:
11831183
listing = tmp_path.iterdir()
1184-
cidfiles = tmp_path.glob("**/pytestcid*")
1185-
cidfiles_count = sum(1 for _ in cidfiles)
1184+
cidfiles_count = sum(1 for _ in tmp_path.glob("**/pytestcid*"))
11861185
stderr = re.sub(r"\s\s+", " ", stderr)
11871186
assert "completed success" in stderr
11881187
assert error_code == 0

tests/test_iwdr.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ def test_iwdr_permutations(tmp_path_factory: Any) -> None:
131131
)
132132
assert err_code == 0
133133
log = json.loads(stdout)["log"]
134-
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log
134+
with open(log["path"]) as log_h:
135+
log_text = log_h.read()
136+
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log_text
135137

136138

137139
def test_iwdr_permutations_readonly(tmp_path_factory: Any) -> None:
@@ -240,7 +242,9 @@ def test_iwdr_permutations_inplace(tmp_path_factory: Any) -> None:
240242
)
241243
assert err_code == 0
242244
log = json.loads(stdout)["log"]
243-
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log
245+
with open(log["path"]) as log_h:
246+
log_text = log_h.read()
247+
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log_text
244248

245249

246250
@needs_singularity
@@ -298,7 +302,9 @@ def test_iwdr_permutations_singularity(tmp_path_factory: Any) -> None:
298302
)
299303
assert err_code == 0
300304
log = json.loads(stdout)["log"]
301-
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log
305+
with open(log["path"]) as log_h:
306+
log_text = log_h.read()
307+
assert log["checksum"] == "sha1$bc51ebb3f65ca44282789dd1e6de9747d8abe75f", log_text
302308

303309

304310
@needs_singularity

tests/test_udocker.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ def test_udocker_usage_should_not_write_cid_file(udocker: str, tmp_path: Path) -
5050
"""Confirm that no cidfile is made when udocker is used."""
5151

5252
with working_directory(tmp_path):
53-
test_file = "tests/echo-position-expr.cwl"
54-
job_file = "tests/echo-position-echo-position-expr-job.yml"
53+
test_file = "tests/echo.cwl"
5554
error_code, stdout, stderr = get_main_output(
5655
[
5756
"--debug",
5857
"--default-container",
5958
"debian:stable-slim",
6059
"--user-space-docker-cmd=" + udocker,
6160
get_data(test_file),
62-
get_data(job_file),
61+
"--inp",
62+
"hello",
6363
]
6464
)
6565

0 commit comments

Comments
 (0)