From 3a33ed7c46909a0a37bd5e12edfd896350be1f6c Mon Sep 17 00:00:00 2001 From: Samuel Leathers Date: Fri, 15 Sep 2017 19:16:11 -0400 Subject: [PATCH] trollius: fix tests --- .../python-modules/trollius/default.nix | 49 +++++++++++++++ .../python-modules/trollius/tests.patch | 13 ++++ pkgs/top-level/python-packages.nix | 60 +------------------ 3 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 pkgs/development/python-modules/trollius/default.nix create mode 100644 pkgs/development/python-modules/trollius/tests.patch diff --git a/pkgs/development/python-modules/trollius/default.nix b/pkgs/development/python-modules/trollius/default.nix new file mode 100644 index 000000000000..ef367c3525d3 --- /dev/null +++ b/pkgs/development/python-modules/trollius/default.nix @@ -0,0 +1,49 @@ +{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, isPy26, isPyPy, mock, futures }: +buildPythonPackage rec { + pname = "trollius"; + version = "1.0.4"; + name = "${pname}-${version}"; + + disabled = isPy26; + + src = fetchPypi { + inherit pname version; + sha256 = "0xny8y12x3wrflmyn6xi8a7n3m3ac80fgmgzphx5jbbaxkjcm148"; + }; + + buildInputs = [ mock ]; + + propagatedBuildInputs = lib.optional (isPy27 || isPyPy) [ futures ]; + + patches = [ + ./tests.patch + ]; + + # Some of the tests fail on darwin with `error: AF_UNIX path too long' + # because of the *long* path names for sockets + patchPhase = lib.optionalString stdenv.isDarwin '' + sed -i -e "s|test_create_ssl_unix_connection|skip_test_create_ssl_unix_connection|g" tests/test_events.py + sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|g" tests/test_events.py + sed -i -e "s|test_create_unix_server_existing_path_nonsock|skip_test_create_unix_server_existing_path_nonsock|g" tests/test_unix_events.py + sed -i -e "s|test_create_unix_server_existing_path_sock|skip_test_create_unix_server_existing_path_sock|g" tests/test_unix_events.py + sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|g" tests/test_events.py + sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|g" tests/test_events.py + sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|g" tests/test_events.py + sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|g" tests/test_events.py + sed -i -e "s|test_open_unix_connection_error|skip_test_open_unix_connection_error|g" tests/test_streams.py + sed -i -e "s|test_open_unix_connection_no_loop_ssl|skip_test_open_unix_connection_no_loop_ssl|g" tests/test_streams.py + sed -i -e "s|test_open_unix_connection|skip_test_open_unix_connection|g" tests/test_streams.py + sed -i -e "s|test_pause_reading|skip_test_pause_reading|g" tests/test_subprocess.py + sed -i -e "s|test_read_pty_output|skip_test_read_pty_output|g" tests/test_events.py + sed -i -e "s|test_start_unix_server|skip_test_start_unix_server|g" tests/test_streams.py + sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|g" tests/test_events.py + sed -i -e "s|test_write_pty|skip_test_write_pty|g" tests/test_events.py + ''; + + meta = with stdenv.lib; { + description = "Port of the Tulip project (asyncio module, PEP 3156) on Python 2"; + homepage = "https://bitbucket.org/enovance/trollius"; + license = licenses.asl20; + maintainers = with maintainers; [ garbas ]; + }; +} diff --git a/pkgs/development/python-modules/trollius/tests.patch b/pkgs/development/python-modules/trollius/tests.patch new file mode 100644 index 000000000000..4923bded9493 --- /dev/null +++ b/pkgs/development/python-modules/trollius/tests.patch @@ -0,0 +1,13 @@ +diff --git i/tests/test_asyncio.py w/tests/test_asyncio.py +index 39d9e1a..05b7e6f 100644 +--- i/tests/test_asyncio.py ++++ w/tests/test_asyncio.py +@@ -69,7 +69,7 @@ class AsyncioTests(test_utils.TestCase): + def step_future(): + future = asyncio.Future() + self.loop.call_soon(future.set_result, "asyncio.Future") +- return (yield from future) ++ return (yield From(future)) + + # test in release mode + trollius.coroutines._DEBUG = False diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6217920b96d1..bfa98967b448 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -25130,65 +25130,7 @@ EOF }; }; - trollius = buildPythonPackage rec { - version = "1.0.4"; - name = "trollius-${version}"; - disabled = isPy34; - - src = pkgs.fetchurl { - url = "mirror://pypi/t/trollius/${name}.tar.gz"; - sha256 = "8884cae4ec6a2d593abcffd5e700626ad4618f42b11beb2b75998f2e8247de76"; - }; - - buildInputs = with self; [ mock ] - ++ optional isPy26 unittest2; - - propagatedBuildInputs = with self; [] - ++ optional isPy26 ordereddict - ++ optional (isPy26 || isPy27 || isPyPy) futures; - - # Some of the tests fail on darwin with `error: AF_UNIX path too long' - # because of the *long* path names for sockets - patchPhase = optionalString stdenv.isDarwin '' - sed -i -e "s|test_create_ssl_unix_connection|skip_test_create_ssl_unix_connection|" tests/test_events.py - sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|" tests/test_events.py - sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|" tests/test_events.py - sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|" tests/test_events.py - sed -i -e "s|test_create_unix_server_existing_path_nonsock|skip_test_create_unix_server_existing_path_nonsock|" tests/test_unix_events.py - sed -i -e "s|test_create_unix_server_existing_path_sock|skip_test_create_unix_server_existing_path_sock|" tests/test_unix_events.py - sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|" tests/test_events.py - sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|" tests/test_events.py - sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|" tests/test_events.py - sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|" tests/test_events.py - sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|" tests/test_events.py - sed -i -e "s|test_open_unix_connection_error|skip_test_open_unix_connection_error|" tests/test_streams.py - sed -i -e "s|test_open_unix_connection_no_loop_ssl|skip_test_open_unix_connection_no_loop_ssl|" tests/test_streams.py - sed -i -e "s|test_open_unix_connection|skip_test_open_unix_connection|" tests/test_streams.py - sed -i -e "s|test_pause_reading|skip_test_pause_reading|" tests/test_subprocess.py - sed -i -e "s|test_read_pty_output|skip_test_read_pty_output|" tests/test_events.py - sed -i -e "s|test_start_unix_server|skip_test_start_unix_server|" tests/test_streams.py - sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|" tests/test_events.py - sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|" tests/test_events.py - sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|" tests/test_events.py - sed -i -e "s|test_write_pty|skip_test_write_pty|" tests/test_events.py - '' + optionalString isPy26 '' - sed -i -e "s|test_env_var_debug|skip_test_env_var_debug|" tests/test_tasks.py - ''; - - meta = { - description = "Port of the Tulip project (asyncio module, PEP 3156) on Python 2"; - homepage = "https://bitbucket.org/enovance/trollius"; - license = licenses.asl20; - maintainers = with maintainers; [ garbas ]; - }; - }; + trollius = callPackage ../development/python-modules/trollius {}; neovim = buildPythonPackage rec { version = "0.1.13";