Skip to content

Commit 7a32450

Browse files
committed
test: gold files shouldn't be ignored
I made a private copy of this repo to check something, and xml gold tests were failing because my new private repo didn't have the coverage.xml gold files, because they were in .gitignore.
1 parent 44aa528 commit 7a32450

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
*.bak
88
.coverage
99
.coverage.*
10-
coverage.xml
11-
coverage.json
1210
.metacov
1311
.metacov.*
1412
*.swp
1513

14+
# Data files we should ignore in the root, but need for gold files.
15+
/coverage.xml
16+
/coverage.json
17+
1618
# Stuff generated by editors.
1719
.idea/
1820
.vscode/

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ clean: clean_platform ## Remove artifacts of test execution, installation, etc
3232
@rm -f *.bak */*.bak */*/*.bak */*/*/*.bak */*/*/*/*.bak */*/*/*/*/*.bak
3333
@rm -f coverage/*,cover
3434
@rm -f MANIFEST
35-
@rm -f .coverage .coverage.* coverage.xml coverage.json .metacov*
35+
@rm -f .coverage .coverage.* .metacov*
36+
@rm -f coverage.xml coverage.json
3637
@rm -f .tox/*/lib/*/site-packages/zzz_metacov.pth
3738
@rm -f */.coverage */*/.coverage */*/*/.coverage */*/*/*/.coverage */*/*/*/*/.coverage */*/*/*/*/*/.coverage
3839
@rm -f tests/covmain.zip tests/zipmods.zip tests/zip1.zip

tests/goldtest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ def save_mismatch(f: str) -> None:
9999

100100
assert not text_diff, "Files differ: " + "\n".join(text_diff)
101101

102-
assert not expected_only, f"Files in {expected_dir} only: {expected_only}"
102+
assert not expected_only, f"Files in {os.path.abspath(expected_dir)} only: {expected_only}"
103103
if not actual_extra:
104-
assert not actual_only, f"Files in {actual_dir} only: {actual_only}"
104+
assert not actual_only, f"Files in {os.path.abspath(actual_dir)} only: {actual_only}"
105105

106106

107107
def contains(filename: str, *strlist: str) -> None:

tests/test_goldtest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def test_actual_extra(self) -> None:
105105
compare(gold_path("testing/getty"), "out", scrubs=SCRUBS, actual_extra=True)
106106

107107
# But not without it:
108-
msg = r"Files in out only: \['another.more'\]"
108+
# (test output is in files like /tmp/pytest-of-user/pytest-0/popen-gw3/t76/out)
109+
msg = r"Files in .*[/\\]t\d+[/\\]out only: \['another.more'\]"
109110
with pytest.raises(AssertionError, match=msg):
110111
compare(gold_path("testing/getty"), "out", scrubs=SCRUBS)
111112
self.assert_exists(os.path.join(TESTS_DIR, "actual/testing/getty/another.more"))

0 commit comments

Comments
 (0)