From 9e3b985316169038739ce85227ead27e828c0aea Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 29 Aug 2021 16:43:10 +0200 Subject: [PATCH] python3Packages.ipykernel: add missing deps and split off tests The package now requires debugpy and the tests require ipyparallel. The latter causes an infinite recursion, which is why I split out the tests into `passthru.tests.pytest`. There is not dedicated tests output, because the tests require relative imports. --- .../python-modules/ipykernel/default.nix | 47 +++++---------- .../python-modules/ipykernel/tests.nix | 57 +++++++++++++++++++ 2 files changed, 72 insertions(+), 32 deletions(-) create mode 100644 pkgs/development/python-modules/ipykernel/tests.nix diff --git a/pkgs/development/python-modules/ipykernel/default.nix b/pkgs/development/python-modules/ipykernel/default.nix index db87d371e3f2..a34af6eca28f 100644 --- a/pkgs/development/python-modules/ipykernel/default.nix +++ b/pkgs/development/python-modules/ipykernel/default.nix @@ -1,15 +1,14 @@ { lib , stdenv , buildPythonPackage +, callPackage , fetchPypi -, flaky +, debugpy , ipython , jupyter_client -, traitlets , tornado +, traitlets , pythonOlder -, pytestCheckHook -, nose }: buildPythonPackage rec { @@ -21,36 +20,20 @@ buildPythonPackage rec { sha256 = "4439459f171d77f35b7f7e72dace5d7c2dd10a5c9e2c22b173ad9048fbfe7656"; }; - propagatedBuildInputs = [ ipython jupyter_client traitlets tornado ]; + propagatedBuildInputs = [ + debugpy + ipython + jupyter_client + tornado + traitlets + ]; - checkInputs = [ pytestCheckHook nose flaky ]; - dontUseSetuptoolsCheck = true; - preCheck = '' - export HOME=$(mktemp -d) - ''; - disabledTests = lib.optionals stdenv.isDarwin ([ - # see https://github.com/NixOS/nixpkgs/issues/76197 - "test_subprocess_print" - "test_subprocess_error" - "test_ipython_start_kernel_no_userns" + # check in passthru.tests.pytest to escape infinite recursion with ipyparallel + doCheck = false; - # https://github.com/ipython/ipykernel/issues/506 - "test_unc_paths" - ] ++ lib.optionals (pythonOlder "3.8") [ - # flaky test https://github.com/ipython/ipykernel/issues/485 - "test_shutdown" - - # test regression https://github.com/ipython/ipykernel/issues/486 - "test_sys_path_profile_dir" - "test_save_history" - "test_help_output" - "test_write_kernel_spec" - "test_ipython_start_kernel_userns" - "ZMQDisplayPublisherTests" - ]); - - # Some of the tests use localhost networking. - __darwinAllowLocalNetworking = true; + passthru.tests = { + pytest = callPackage ./tests.nix { }; + }; meta = { description = "IPython Kernel for Jupyter"; diff --git a/pkgs/development/python-modules/ipykernel/tests.nix b/pkgs/development/python-modules/ipykernel/tests.nix new file mode 100644 index 000000000000..9375dbc2bfdc --- /dev/null +++ b/pkgs/development/python-modules/ipykernel/tests.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, buildPythonPackage +, pythonOlder +, flaky +, ipykernel +, ipyparallel +, nose +, pytestCheckHook + +}: + +buildPythonPackage rec { + pname = "ipykernel-tests"; + inherit (ipykernel) version; + + src = ipykernel.src; + + dontBuild = true; + dontInstall = true; + + checkInputs = [ + flaky + ipykernel + ipyparallel + nose + pytestCheckHook + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + disabledTests = lib.optionals stdenv.isDarwin ([ + # see https://github.com/NixOS/nixpkgs/issues/76197 + "test_subprocess_print" + "test_subprocess_error" + "test_ipython_start_kernel_no_userns" + + # https://github.com/ipython/ipykernel/issues/506 + "test_unc_paths" + ] ++ lib.optionals (pythonOlder "3.8") [ + # flaky test https://github.com/ipython/ipykernel/issues/485 + "test_shutdown" + + # test regression https://github.com/ipython/ipykernel/issues/486 + "test_sys_path_profile_dir" + "test_save_history" + "test_help_output" + "test_write_kernel_spec" + "test_ipython_start_kernel_userns" + "ZMQDisplayPublisherTests" + ]); + + # Some of the tests use localhost networking. + __darwinAllowLocalNetworking = true; +}