mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-29 18:44:43 +00:00
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:
parent
42c75b5ef9
commit
a4967fe92c
4 changed files with 13 additions and 1 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
5
tests/checker/data/utf8.html
Normal file
5
tests/checker/data/utf8.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<p>Some text — but with an em-dash.</p>
|
||||
</html>
|
||||
0
tests/checker/data/utf8.html.result
Normal file
0
tests/checker/data/utf8.html.result
Normal 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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue