feat: Save HTML source to file when tidy validation fails during test (#3646)
Instead of dumping the whole source code to the console.
This commit is contained in:
parent
0bbe216ebd
commit
5587428ebc
|
@ -200,12 +200,13 @@ class VerifyingClient(Client):
|
|||
)
|
||||
|
||||
if errors:
|
||||
n = 1
|
||||
print("\n")
|
||||
for line in r.content.decode().splitlines():
|
||||
print(f"{n: 6}: {line}")
|
||||
n += 1
|
||||
print(path)
|
||||
file_name = "error" + re.sub("/", "-", path) + "source.html"
|
||||
with open(file_name, "w") as src:
|
||||
src.write(r.content.decode())
|
||||
print("\nHTML validation error for URL path", path)
|
||||
print("HTML source saved to", file_name)
|
||||
print("See AssertionError below for error location in HTML source.")
|
||||
|
||||
self.test.maxDiff = None
|
||||
self.test.assertEqual("", errors)
|
||||
return r
|
||||
|
|
Loading…
Reference in a new issue