about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorDrew Risinger <drewrisinger@users.noreply.github.com>2020-04-03 16:22:04 -0400
committerDrew Risinger <drewrisinger@users.noreply.github.com>2020-04-03 20:41:34 -0400
commit364909d53558ccd6adb5cf135992c6f318d6e80a (patch)
tree5261e37214ed1d9d8402512aa7663a64d49562d7 /pkgs/development
parent7f20da7850a878747f55043a02e8dc7ca36a3b14 (diff)
downloadnixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar.gz
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar.bz2
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar.lz
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar.xz
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.tar.zst
nixlib-364909d53558ccd6adb5cf135992c6f318d6e80a.zip
python3Packages.uvloop: enable on python3.8
Allow build pass by disabling test. Isolated issue to
test_sockets.py::TestAIOSockets::test_sock_close_add_reader_race.
This test is supposed to be skipped, but it isn't for some reason,
so we disable it instead.
See uvloop#284 (https://github.com/MagicStack/uvloop/pull/284)
for full details. Don't know why this test isn't properly skipped.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/python-modules/uvloop/default.nix45
1 files changed, 35 insertions, 10 deletions
diff --git a/pkgs/development/python-modules/uvloop/default.nix b/pkgs/development/python-modules/uvloop/default.nix
index 36c5af1d7180..109d8d8efab2 100644
--- a/pkgs/development/python-modules/uvloop/default.nix
+++ b/pkgs/development/python-modules/uvloop/default.nix
@@ -6,16 +6,17 @@
 , libuv
 , psutil
 , isPy27
-, pythonAtLeast
 , CoreServices
 , ApplicationServices
+# Check Inputs
+, pytestCheckHook
+# , pytest-asyncio
 }:
 
 buildPythonPackage rec {
   pname = "uvloop";
   version = "0.14.0";
-  # python 3.8 hangs on tests, assuming it's subtly broken with race condition
-  disabled = isPy27 || pythonAtLeast "3.8";
+  disabled = isPy27;
 
   src = fetchPypi {
     inherit pname version;
@@ -28,20 +29,44 @@ buildPythonPackage rec {
     libuv
   ] ++ lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ];
 
-  postPatch = ''
-    # Removing code linting tests, which we don't care about
-    rm tests/test_sourcecode.py
-  '';
+  pythonImportsCheck = [
+    "uvloop"
+    "uvloop.loop"
+  ];
+
+  dontUseSetuptoolsCheck = true;
+  checkInputs = [ pytestCheckHook pyopenssl psutil ];
+
+  pytestFlagsArray = [
+    # from pytest.ini, these are NECESSARY to prevent failures
+    "--capture=no"
+    "--assert=plain"
+    "--tb=native"
+    # ignore code linting tests
+    "--ignore=tests/test_sourcecode.py"
+  ];
 
-  checkInputs = [ pyopenssl psutil ];
+  disabledTests = [
+    "test_sock_cancel_add_reader_race"  # asyncio version of test is supposed to be skipped but skip doesn't happen. uvloop version runs fine
+  ];
+
+  # force using installed/compiled uvloop vs source by moving tests to temp dir
+  preCheck = ''
+    export TEST_DIR=$(mktemp -d)
+    cp -r tests $TEST_DIR
+    pushd $TEST_DIR
+  '';
+  postCheck = ''
+    popd
+  '';
 
   # Some of the tests use localhost networking.
   __darwinAllowLocalNetworking = true;
 
   meta = with lib; {
     description = "Fast implementation of asyncio event loop on top of libuv";
-    homepage = https://github.com/MagicStack/uvloop;
+    homepage = "https://github.com/MagicStack/uvloop";
     license = licenses.mit;
-    maintainers = [ maintainers.costrouc ];
+    maintainers = with maintainers; [ costrouc ];
   };
 }