From patchwork Thu Jan 3 21:34:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 655 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5F1F916A01; Thu, 3 Jan 2019 21:36:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mira.cbaines.net (Postfix) with ESMTP id 93F9B169FC for ; Thu, 3 Jan 2019 21:36:18 +0000 (GMT) Received: from localhost ([127.0.0.1]:58019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfAf4-0006gL-3q for patchwork@mira.cbaines.net; Thu, 03 Jan 2019 16:36:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfAes-0006d7-6w for guix-patches@gnu.org; Thu, 03 Jan 2019 16:36:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfAen-0004yv-V1 for guix-patches@gnu.org; Thu, 03 Jan 2019 16:36:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:39525) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gfAen-0004yl-QU for guix-patches@gnu.org; Thu, 03 Jan 2019 16:36:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gfAen-0000wn-MB for guix-patches@gnu.org; Thu, 03 Jan 2019 16:36:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33759] [PATCH v2 5/5] gnu: linkchecker: Fix the package building. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Jan 2019 21:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33759 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33759@debbugs.gnu.org Received: via spool by 33759-submit@debbugs.gnu.org id=B33759.15465513113581 (code B ref 33759); Thu, 03 Jan 2019 21:36:01 +0000 Received: (at 33759) by debbugs.gnu.org; 3 Jan 2019 21:35:11 +0000 Received: from localhost ([127.0.0.1]:46022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfAdq-0000v3-VH for submit@debbugs.gnu.org; Thu, 03 Jan 2019 16:35:10 -0500 Received: from li622-129.members.linode.com ([212.71.249.129]:56812 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfAdh-0000tY-US for 33759@debbugs.gnu.org; Thu, 03 Jan 2019 16:35:01 -0500 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 65A2216A0E for <33759@debbugs.gnu.org>; Thu, 3 Jan 2019 21:34:53 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 22159e2d for <33759@debbugs.gnu.org>; Thu, 3 Jan 2019 21:34:52 +0000 (UTC) From: Christopher Baines Date: Thu, 3 Jan 2019 21:34:52 +0000 Message-Id: <20190103213452.1829-5-mail@cbaines.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190103213452.1829-1-mail@cbaines.net> References: <20181215121700.11320-1-mail@cbaines.net> <20190103213452.1829-1-mail@cbaines.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/python.scm (linkchecker)[source]: Add patch. [native-inputs]: Add more inputs required for the tests. [arguments]: Enable the tests, move the 'check phase after 'install. Test using the installed software, and use py.test. --- gnu/local.mk | 1 + ...-more-tests-that-require-the-network.patch | 182 ++++++++++++++++++ gnu/packages/web.scm | 30 ++- 3 files changed, 209 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/linkchecker-mark-more-tests-that-require-the-network.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0bb0203354..e0a5fa60ae 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -935,6 +935,7 @@ dist_patch_DATA = \ %D%/packages/patches/lierolibre-newer-libconfig.patch \ %D%/packages/patches/lierolibre-remove-arch-warning.patch \ %D%/packages/patches/lierolibre-try-building-other-arch.patch \ + %D%/packages/patches/linkchecker-mark-more-tests-that-require-the-network.patch.patch \ %D%/packages/patches/linux-pam-no-setfsuid.patch \ %D%/packages/patches/lirc-localstatedir.patch \ %D%/packages/patches/lirc-reproducible-build.patch \ diff --git a/gnu/packages/patches/linkchecker-mark-more-tests-that-require-the-network.patch b/gnu/packages/patches/linkchecker-mark-more-tests-that-require-the-network.patch new file mode 100644 index 0000000000..f3e488cec2 --- /dev/null +++ b/gnu/packages/patches/linkchecker-mark-more-tests-that-require-the-network.patch @@ -0,0 +1,182 @@ +From f24c88a0732024028fffe0372039a847e91722ea Mon Sep 17 00:00:00 2001 +From: Christopher Baines +Date: Tue, 1 Jan 2019 22:36:29 +0000 +Subject: [PATCH] Mark more tests that require the network + +I believe all these tests require the network, at least they seem to +fail if it's I run them without connecting my computer to the web. + +I'm looking at this as part of packaging linkchecker for GNU Guix, +where the package is build and the tests are run in a isolated +environment, intentionally without network access, to avoid issues +with non-reproducible package builds. +--- + tests/checker/test_http.py | 2 ++ + tests/checker/test_http_misc.py | 2 ++ + tests/checker/test_http_redirect.py | 2 ++ + tests/checker/test_httpbin.py | 5 +++++ + tests/checker/test_misc.py | 4 ++++ + tests/checker/test_whitespace.py | 3 +++ + 6 files changed, 18 insertions(+) + +diff --git a/tests/checker/test_http.py b/tests/checker/test_http.py +index e4c1e097..8a8af567 100644 +--- a/tests/checker/test_http.py ++++ b/tests/checker/test_http.py +@@ -20,6 +20,7 @@ + + import pytest + ++from tests import need_network + from .httpserver import HttpServerTest, CookieRedirectHttpRequestHandler + + class TestHttp (HttpServerTest): +@@ -29,6 +30,7 @@ def __init__(self, methodName='runTest'): + super(TestHttp, self).__init__(methodName=methodName) + self.handler = CookieRedirectHttpRequestHandler + ++ @need_network + def test_html (self): + confargs = dict(recursionlevel=1) + self.file_test("http.html", confargs=confargs) +diff --git a/tests/checker/test_http_misc.py b/tests/checker/test_http_misc.py +index 9922d85f..c6b6afdb 100644 +--- a/tests/checker/test_http_misc.py ++++ b/tests/checker/test_http_misc.py +@@ -20,11 +20,13 @@ + import os + import sys + from .httpserver import HttpServerTest ++from tests import need_network + from linkcheck.network import iputil + + class TestHttpMisc (HttpServerTest): + """Test http:// misc link checking.""" + ++ @need_network + def test_html (self): + self.swf_test() + self.obfuscate_test() +diff --git a/tests/checker/test_http_redirect.py b/tests/checker/test_http_redirect.py +index f212d98e..2253a70d 100644 +--- a/tests/checker/test_http_redirect.py ++++ b/tests/checker/test_http_redirect.py +@@ -17,6 +17,7 @@ + """ + Test http checking. + """ ++from tests import need_network + from .httpserver import HttpServerTest, CookieRedirectHttpRequestHandler + + class TestHttpRedirect (HttpServerTest): +@@ -26,6 +27,7 @@ def __init__(self, methodName='runTest'): + super(TestHttpRedirect, self).__init__(methodName=methodName) + self.handler = CookieRedirectHttpRequestHandler + ++ @need_network + def test_redirect (self): + self.redirect1() + self.redirect2() +diff --git a/tests/checker/test_httpbin.py b/tests/checker/test_httpbin.py +index 0319c2f6..4c8fa846 100644 +--- a/tests/checker/test_httpbin.py ++++ b/tests/checker/test_httpbin.py +@@ -18,6 +18,7 @@ + Test http stuff with httpbin.org. + """ + import re ++from tests import need_network + from . import LinkCheckTest + + +@@ -30,6 +31,7 @@ def get_httpbin_url(path): + class TestHttpbin(LinkCheckTest): + """Test http:// link redirection checking.""" + ++ @need_network + def test_http_link(self): + linkurl = u"http://www.example.com" + nlinkurl = self.norm(linkurl) +@@ -48,6 +50,7 @@ def test_http_link(self): + ] + self.direct(url, resultlines, recursionlevel=1) + ++ @need_network + def test_basic_auth(self): + user = u"testuser" + password = u"testpassword" +@@ -67,6 +70,7 @@ def test_basic_auth(self): + ] + self.direct(url, resultlines, confargs=confargs) + ++ @need_network + def test_http_refresh_header(self): + linkurl = u"http://www.example.com" + nlinkurl = self.norm(linkurl) +@@ -85,6 +89,7 @@ def test_http_refresh_header(self): + ] + self.direct(url, resultlines, recursionlevel=1) + ++ @need_network + def test_http_content_location_header(self): + linkurl = u"http://www.example.com" + nlinkurl = self.norm(linkurl) +diff --git a/tests/checker/test_misc.py b/tests/checker/test_misc.py +index 2e4cfd07..f9591f9d 100644 +--- a/tests/checker/test_misc.py ++++ b/tests/checker/test_misc.py +@@ -17,6 +17,7 @@ + """ + Test miscellaneous html tag parsing and URL types + """ ++from tests import need_network + from . import LinkCheckTest + + +@@ -25,15 +26,18 @@ class TestMisc (LinkCheckTest): + Test misc link types. + """ + ++ @need_network + def test_misc (self): + self.file_test("misc.html") + + def test_html5 (self): + self.file_test("html5.html") + ++ @need_network + def test_archive (self): + self.file_test("archive.html") + ++ @need_network + def test_itms_services(self): + url = u"itms-services:?action=download-manifest&url=http://www.example.com/" + resultlines = [ +diff --git a/tests/checker/test_whitespace.py b/tests/checker/test_whitespace.py +index 609c108a..fc2727d6 100644 +--- a/tests/checker/test_whitespace.py ++++ b/tests/checker/test_whitespace.py +@@ -17,6 +17,7 @@ + """ + Test whitespace handling. + """ ++from tests import need_network + from . import LinkCheckTest + + +@@ -25,6 +26,7 @@ class TestWhitespace (LinkCheckTest): + Test whitespace in URLs. + """ + ++ @need_network + def test_leading_whitespace (self): + # Leading whitespace + url = u" http://www.example.org/" +@@ -50,6 +52,7 @@ def test_leading_whitespace (self): + ] + self.direct(url, resultlines) + ++ @need_network + def test_trailing_whitespace (self): + # Trailing whitespace + url = u"http://www.example.org/ " diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 607f8efe69..65901a5aeb 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -5805,6 +5805,9 @@ Instagram and YouTube.") (uri (git-reference (url "https://github.com/linkchecker/linkchecker") (commit (string-append "v" version)))) + (patches + (search-patches + "linkchecker-mark-more-tests-that-require-the-network.patch")) (file-name (git-file-name name version)) (sha256 (base32 @@ -5815,12 +5818,31 @@ Instagram and YouTube.") ("python2-pyxdg" ,python2-pyxdg) ("python2-requests" ,python2-requests))) (native-inputs - `(("python2-pytest" ,python2-pytest))) + `(("gettext" ,gettext-minimal) + ("python2-pytest" ,python2-pytest) + ("python2-miniboa" ,python2-miniboa) + ("python2-parameterized" ,python2-parameterized))) (arguments `(#:python ,python-2 - ;; TODO: Tests currently fail. Looks to be a mixture of trying to use - ;; /homeless-shelter and maybe the network. - #:tests? #f)) + #:phases + (modify-phases %standard-phases + ;; Move the 'check phase to after 'install, so that the installed + ;; library can be used + (delete 'check) + (add-after 'install 'check + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + ;; Set PYTHONPATH so that the installed linkchecker is used + (setenv "PYTHONPATH" + (string-append out "/lib/python2.7/site-packages" + ":" + (getenv "PYTHONPATH"))) + ;; Remove this directory to avoid it being used when running + ;; the tests + (delete-file-recursively "linkcheck") + + (invoke "py.test" "tests")) + #t))))) (home-page "https://linkcheck.github.io/linkchecker") (synopsis "Check websites for broken links") (description "LinkChecker is a website validator. It checks for broken