From 32689ea230b7fe6e1ca5c176f4080dd950af756e Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 25 May 2020 19:55:28 +0100 Subject: [PATCH 1/3] Enable as many TestHttp html tests as possible without the internet --- tests/checker/test_http.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/checker/test_http.py b/tests/checker/test_http.py index 8f282afe..8ec1eded 100644 --- a/tests/checker/test_http.py +++ b/tests/checker/test_http.py @@ -28,17 +28,20 @@ class TestHttp(HttpServerTest): self.handler = CookieRedirectHttpRequestHandler @need_network - def test_html(self): + def test_html_internet(self): confargs = dict(recursionlevel=1) self.file_test("http.html", confargs=confargs) self.file_test("http_lowercase.html", confargs=confargs) self.file_test("http_quotes.html", confargs=confargs) self.file_test("http_slash.html", confargs=confargs) - self.file_test("http.xhtml", confargs=confargs) + self.file_test("http_url_quote.html", confargs=confargs) + + def test_html(self): + confargs = dict(recursionlevel=1) + self.file_test("http_empty.html", confargs=confargs) self.file_test("http_file.html", confargs=confargs) self.file_test("http_utf8.html", confargs=confargs) - self.file_test("http_url_quote.html", confargs=confargs) - self.file_test("http_empty.html", confargs=confargs) + self.file_test("http.xhtml", confargs=confargs) def test_status(self): for status in sorted(self.handler.responses.keys()): From d3c9618b1b80fa7d05e3bd637584f077c70f12e7 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 25 May 2020 19:55:28 +0100 Subject: [PATCH 2/3] TestHttps.test_https doesn't need the internet now A result of changes introduced in: dee4be4b ("Enable https checking using a test server", 2019-11-11) --- tests/checker/test_https.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/checker/test_https.py b/tests/checker/test_https.py index 4b11e95e..52ccdba9 100644 --- a/tests/checker/test_https.py +++ b/tests/checker/test_https.py @@ -51,7 +51,6 @@ class TestHttps(HttpsServerTest): with open(get_file("https_cert.pem"), "wb") as f: f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert)) - @need_network def test_https(self): url = self.get_url("") resultlines = [ From f6e182f0e47a1702ff3df663ff97fb5b18c6e29a Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 25 May 2020 19:55:28 +0100 Subject: [PATCH 3/3] Mark TestFile.test_html_url_quote as need_network Else without the internet the test fails, eventually, with: warning No MX mail host for users.sourceforge.net found --- tests/checker/test_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/checker/test_file.py b/tests/checker/test_file.py index 1a0067af..d662b668 100644 --- a/tests/checker/test_file.py +++ b/tests/checker/test_file.py @@ -22,7 +22,7 @@ import zipfile import pytest -from tests import need_word, need_pdflib +from tests import need_network, need_word, need_pdflib from . import LinkCheckTest, get_file @@ -48,6 +48,7 @@ class TestFile(LinkCheckTest): def test_html(self): self.file_test("file.html") + @need_network def test_html_url_quote(self): self.file_test("file_url_quote.html")