about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2017-10-23 12:51:38 +0200
committerRobin Gloster <mail@glob.in>2017-10-24 15:31:50 +0200
commit38c04e691ce90ea12f68107bec47057915903f02 (patch)
tree98d8f8f02d9b2d9d0f42e679d931b5877c9cb23c
parent322fa6b06cfbe66ef1bc12b1bfd5fd37d63cbf87 (diff)
downloadnixlib-38c04e691ce90ea12f68107bec47057915903f02.tar
nixlib-38c04e691ce90ea12f68107bec47057915903f02.tar.gz
nixlib-38c04e691ce90ea12f68107bec47057915903f02.tar.bz2
nixlib-38c04e691ce90ea12f68107bec47057915903f02.tar.lz
nixlib-38c04e691ce90ea12f68107bec47057915903f02.tar.xz
nixlib-38c04e691ce90ea12f68107bec47057915903f02.tar.zst
nixlib-38c04e691ce90ea12f68107bec47057915903f02.zip
python.pkgs.jupyter_core: own file, enable tests
-rw-r--r--pkgs/development/python-modules/jupyter_core/default.nix38
-rw-r--r--pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch24
-rw-r--r--pkgs/top-level/python-packages.nix27
3 files changed, 63 insertions, 26 deletions
diff --git a/pkgs/development/python-modules/jupyter_core/default.nix b/pkgs/development/python-modules/jupyter_core/default.nix
new file mode 100644
index 000000000000..4db36cf7b374
--- /dev/null
+++ b/pkgs/development/python-modules/jupyter_core/default.nix
@@ -0,0 +1,38 @@
+{ lib
+, python
+, buildPythonPackage
+, fetchPypi
+, ipython
+, traitlets
+, glibcLocales
+, mock
+, pytest
+}:
+
+buildPythonPackage rec {
+  pname = "jupyter_core";
+  version = "4.3.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "a96b129e1641425bf057c3d46f4f44adce747a7d60107e8ad771045c36514d40";
+  };
+
+  buildInputs = [ pytest mock glibcLocales ];
+  propagatedBuildInputs = [ ipython traitlets ];
+
+  patches = [ ./tests_respect_pythonpath.patch ];
+
+  checkPhase = ''
+    mkdir tmp
+    HOME=tmp TMPDIR=tmp LC_ALL=en_US.utf8 py.test
+  '';
+
+  meta = with lib; {
+    description = "Jupyter core package. A base package on which Jupyter projects rely";
+    homepage = http://jupyter.org/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ fridh globin ];
+  };
+}
diff --git a/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch
new file mode 100644
index 000000000000..61415b756abc
--- /dev/null
+++ b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch
@@ -0,0 +1,24 @@
+--- a/jupyter_core/tests/test_command.py	2016-09-13 15:22:49.000000000 +0200
++++ b/jupyter_core/tests/test_command.py	2017-10-23 12:49:27.489527705 +0200
+@@ -113,7 +113,10 @@
+     witness = a.join(witness_cmd)
+     witness.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")'))
+     witness.chmod(0o700)
+-    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': ''})
++    out = check_output(
++        [sys.executable, str(jupyter), 'witness'],
++        env={'PATH': '', 'PYTHONPATH': os.environ['PYTHONPATH']}
++    )
+     assert b'WITNESS' in out
+ 
+ 
+@@ -136,5 +139,8 @@
+     witness_b.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")'))
+     witness_b.chmod(0o700)
+ 
+-    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': str(b)})
++    out = check_output(
++        [sys.executable, str(jupyter), 'witness'],
++        env={'PATH': str(b), 'PYTHONPATH': os.environ['PYTHONPATH']}
++    )
+     assert b'WITNESS A' in out
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 65210b2e0553..d2a4d8e24241 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -10798,32 +10798,7 @@ in {
 
   jupyter_client = callPackage ../development/python-modules/jupyter_client { };
 
-  jupyter_core = buildPythonPackage rec {
-    version = "4.3.0";
-    name = "jupyter_core-${version}";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/j/jupyter_core/${name}.tar.gz";
-      sha256 = "a96b129e1641425bf057c3d46f4f44adce747a7d60107e8ad771045c36514d40";
-    };
-
-    buildInputs = with self; [ pytest mock ];
-    propagatedBuildInputs = with self; [ ipython traitlets];
-
-    checkPhase = ''
-      py.test
-    '';
-
-    # Several tests fail due to being in a chroot
-    doCheck = false;
-
-    meta = {
-      description = "Jupyter core package. A base package on which Jupyter projects rely";
-      homepage = http://jupyter.org/;
-      license = licenses.bsd3;
-      maintainers = with maintainers; [ fridh ];
-    };
-  };
+  jupyter_core = callPackage ../development/python-modules/jupyter_core { };
 
   jsonpath_rw = buildPythonPackage rec {
     name = "jsonpath-rw-${version}";