Skip to content

Commit 577cc29

Browse files
committed
improve test failure reporting
1 parent dfdb2cd commit 577cc29

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tests/test_examples.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,9 @@ def test_cid_file_dir(tmp_path: Path, factor: str) -> None:
11201120
stderr = re.sub(r"\s\s+", " ", stderr)
11211121
assert "completed success" in stderr
11221122
assert error_code == 0
1123-
cidfiles_count = sum(1 for _ in tmp_path.glob("**/*"))
1124-
assert cidfiles_count == 2
1123+
cidfiles = tmp_path.glob("**/*")
1124+
cidfiles_count = sum(1 for _ in cidfiles)
1125+
assert cidfiles_count == 1, list(cidfiles)
11251126

11261127

11271128
@needs_docker
@@ -1180,7 +1181,8 @@ def test_cid_file_w_prefix(tmp_path: Path, factor: str) -> None:
11801181
error_code, stdout, stderr = get_main_output(commands)
11811182
finally:
11821183
listing = tmp_path.iterdir()
1183-
cidfiles_count = sum(1 for _ in tmp_path.glob("**/pytestcid*"))
1184+
cidfiles = tmp_path.glob("**/pytestcid*")
1185+
cidfiles_count = sum(1 for _ in cidfiles)
11841186
stderr = re.sub(r"\s\s+", " ", stderr)
11851187
assert "completed success" in stderr
11861188
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

0 commit comments

Comments
 (0)