about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorDima <dgoldin+github@protonmail.ch>2019-09-07 22:12:11 +0200
committerVladimír Čunát <v@cunat.cz>2019-09-08 09:59:55 +0200
commitb199e30680e182c6776f30caae089db811ad1d52 (patch)
tree8c007ecdd81fac9c0bd752c8b4df57b6ade0301f /pkgs/development/python-modules
parent4f2a3aabff33e4a7dd1f35b4fcd906236073f20b (diff)
downloadnixlib-b199e30680e182c6776f30caae089db811ad1d52.tar
nixlib-b199e30680e182c6776f30caae089db811ad1d52.tar.gz
nixlib-b199e30680e182c6776f30caae089db811ad1d52.tar.bz2
nixlib-b199e30680e182c6776f30caae089db811ad1d52.tar.lz
nixlib-b199e30680e182c6776f30caae089db811ad1d52.tar.xz
nixlib-b199e30680e182c6776f30caae089db811ad1d52.tar.zst
nixlib-b199e30680e182c6776f30caae089db811ad1d52.zip
rfc6555: selectively disable networked tests
(incl. tiny nitpicks from vcunat)
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/rfc6555/default.nix10
-rw-r--r--pkgs/development/python-modules/rfc6555/disable_network_tests.patch31
2 files changed, 38 insertions, 3 deletions
diff --git a/pkgs/development/python-modules/rfc6555/default.nix b/pkgs/development/python-modules/rfc6555/default.nix
index 636427cf7139..0bd7b0ca686c 100644
--- a/pkgs/development/python-modules/rfc6555/default.nix
+++ b/pkgs/development/python-modules/rfc6555/default.nix
@@ -11,9 +11,13 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = with pythonPackages; [ selectors2 ];
 
-  # tests are disabled as rfc6555's 'non-network' tests still require a
-  # functional DNS stack to pass.
-  doCheck = false;
+  checkInputs = with pythonPackages; [ mock pytest ];
+  # disabling tests that require a functional DNS IPv{4,6} stack to pass.
+  patches = [ ./disable_network_tests.patch ];
+  # default doCheck = true; is not enough, apparently
+  postCheck = ''
+    py.test tests/
+  '';
 
   meta = {
     description = "Python implementation of the Happy Eyeballs Algorithm";
diff --git a/pkgs/development/python-modules/rfc6555/disable_network_tests.patch b/pkgs/development/python-modules/rfc6555/disable_network_tests.patch
new file mode 100644
index 000000000000..dc59111ac43f
--- /dev/null
+++ b/pkgs/development/python-modules/rfc6555/disable_network_tests.patch
@@ -0,0 +1,31 @@
+diff --git a/tests/test_create_connection.py b/tests/test_create_connection.py
+index fe38026..cdb26b4 100644
+--- a/tests/test_create_connection.py
++++ b/tests/test_create_connection.py
+@@ -6,10 +6,12 @@ from .test_utils import requires_network
+ 
+ 
+ class _BasicCreateConnectionTests(object):
++
+     @requires_network
+     def test_create_connection_google(self):
+         sock = rfc6555.create_connection(('www.google.com', 80))
+ 
++    @requires_network
+     @pytest.mark.parametrize('timeout', [None, 5.0])
+     def test_create_connection_has_proper_timeout(self, timeout):
+         sock = rfc6555.create_connection(('www.google.com', 80), timeout=timeout)
+diff --git a/tests/test_ipv6.py b/tests/test_ipv6.py
+index 3ee8564..f0db28e 100644
+--- a/tests/test_ipv6.py
++++ b/tests/test_ipv6.py
+@@ -2,7 +2,9 @@ import socket
+ import mock
+ import rfc6555
+ 
++from .test_utils import requires_network
+ 
++@requires_network
+ def test_ipv6_available():
+     assert rfc6555._detect_ipv6()
+