Add a regression test for issue #317

The important bit was making the `file_test` helper not ignore internal
errors.
This commit is contained in:
Marius Gedminas 2019-10-21 17:45:18 +03:00
parent 42c75b5ef9
commit a4967fe92c
4 changed files with 13 additions and 1 deletions

View file

@ -231,10 +231,14 @@ class LinkCheckTest (unittest.TestCase):
url_data = get_url_from(url, 0, aggregate, extern=(0, 0))
aggregate.urlqueue.put(url_data)
linkcheck.director.check_urls(aggregate)
diff = aggregate.config['logger'].diff
logger = aggregate.config['logger']
diff = logger.diff
if diff:
msg = str_text(os.linesep).join([url] + diff)
self.fail_unicode(msg)
if logger.stats.internal_errors:
self.fail_unicode("%d internal errors occurred!"
% logger.stats.internal_errors)
def fail_unicode (self, msg):
"""Print encoded fail message."""

View file

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<p>Some text — but with an em-dash.</p>
</html>

View file

View file

@ -33,6 +33,9 @@ class TestMisc (LinkCheckTest):
def test_html5 (self):
self.file_test("html5.html")
def test_utf8 (self):
self.file_test("utf8.html")
@need_network
def test_archive (self):
self.file_test("archive.html")