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.
This commit is contained in:
Martin Weinelt 2021-08-29 16:43:10 +02:00
parent ebe4ea3be2
commit 9e3b985316
2 changed files with 72 additions and 32 deletions

View File

@ -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";

View File

@ -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;
}