The pybrowser expression in nixpkgs fails in a chroot build when some tests
depending on network access fail. The attached patch removes these tests,
fixing the chroot build.
>From 5d38070ad808907c3a15f62a6e1ee1f3f0fb4c38 Mon Sep 17 00:00:00 2001
From: Karn Kallio <[email protected]>
Date: Sun, 18 Jan 2015 17:56:39 -0430
Subject: [PATCH] pybrowser: fix chroot builds by removing network dependent
tests.
---
.../pybrowser/remove-network-tests.patch | 68 ++++++++++++++++++++++
pkgs/top-level/python-packages.nix | 2 +
2 files changed, 70 insertions(+)
create mode 100644 pkgs/development/python-modules/pybrowser/remove-network-tests.patch
diff --git a/pkgs/development/python-modules/pybrowser/remove-network-tests.patch b/pkgs/development/python-modules/pybrowser/remove-network-tests.patch
new file mode 100644
index 0000000..117e07c
--- /dev/null
+++ b/pkgs/development/python-modules/pybrowser/remove-network-tests.patch
@@ -0,0 +1,68 @@
+diff -Naur pyBrowserID-upstream/browserid/tests/test_verifiers.py pyBrowserID/browserid/tests/test_verifiers.py
+--- pyBrowserID-upstream/browserid/tests/test_verifiers.py 2015-01-18 16:23:23.101657868 -0430
++++ pyBrowserID/browserid/tests/test_verifiers.py 2015-01-18 17:49:03.741138017 -0430
+@@ -126,14 +126,6 @@
+ # There should be a warning about using this verifier.
+ self.assertEquals(w[0].category, FutureWarning)
+
+- def test_error_handling_in_verify_certificate_chain(self):
+- self.assertRaises(ValueError,
+- self.verifier.verify_certificate_chain, [])
+- certs = decode_json_bytes(EXPIRED_ASSERTION)["certificates"]
+- certs = [jwt.parse(cert) for cert in certs]
+- self.assertRaises(ExpiredSignatureError,
+- self.verifier.verify_certificate_chain, certs)
+-
+ @callwith(patched_supportdoc_fetching())
+ def test_well_known_doc_with_public_key(self):
+ assertion = make_assertion("[email protected]", "http://e.com")
+@@ -196,49 +188,6 @@
+ self.assertRaises(AudienceMismatchError, verifier.verify,
+ assertion, audience="example.com")
+
+-
+-class TestRemoteVerifier(unittest.TestCase, VerifierTestCases):
+-
+- def setUp(self):
+- self.verifier = RemoteVerifier(["*"])
+-
+- @patch('browserid.netutils.requests')
+- def _verify(self, requests, response_text='', assertion=EXPIRED_ASSERTION,
+- status_code=200):
+- response = Mock()
+- response.text = response_text
+- response.status_code = status_code
+- requests.request.return_value = response
+-
+- return self.verifier.verify(assertion)
+-
+- def test_handling_of_valid_response_from_server(self):
+- response_text = ('{"email": "[email protected]", "status": "okay", '
+- '"audience": "http://myfavoritebeer.org"}')
+- data = self._verify(response_text=response_text)
+- self.assertEquals(data["email"], "[email protected]")
+-
+- def test_handling_of_invalid_json_from_server(self):
+- with self.assertRaises(ConnectionError):
+- self._verify(response_text='SERVER RETURNS INVALID JSON')
+-
+- @patch('browserid.netutils.requests')
+- def test_handling_of_incorrect_audience_returned_by_server(self, requests):
+- response_text = ('{"email": "[email protected]", "status": "okay", '
+- '"audience": "WRONG"}')
+- with self.assertRaises(AudienceMismatchError):
+- self._verify(response_text=response_text)
+-
+- @patch('browserid.netutils.requests')
+- def test_handling_of_500_error_from_server(self, requests):
+- with self.assertRaises(ValueError):
+- self._verify(status_code=500)
+-
+- def test_handling_of_503_error_from_server(self):
+- with self.assertRaises(ConnectionError):
+- self._verify(status_code=503)
+-
+-
+ class TestDummyVerifier(unittest.TestCase, VerifierTestCases):
+
+ def setUp(self):
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index c907925..1bb8f9f 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -11958,6 +11958,8 @@ let
sha256 = "0nyqb0v8yrkqnrqsh1hlhvzr2pyvkxvkw701p3gpsvk29c0gb5n6";
};
+ patches = [ ../development/python-modules/pybrowser/remove-network-tests.patch ];
+
buildInputs = with self; [ mock unittest2 ];
propagatedBuildInputs = with self; [ requests ];
--
2.1.4
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev