Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonPackages.matplotlib: put tests in separate output #19870

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions pkgs/development/python-modules/matplotlib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, enableGtk3 ? false, cairo
, enableTk ? false, tcl ? null, tk ? null, tkinter ? null, libX11 ? null
, Cocoa, Foundation, CoreData, cf-private, libobjc, libcxx
, glibcLocales
}:

assert enableGhostscript -> ghostscript != null;
Expand All @@ -28,8 +29,9 @@ buildPythonPackage rec {
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";

XDG_RUNTIME_DIR = "/tmp";
LC_ALL="en_US.UTF-8";

buildInputs = [ python which sphinx stdenv ]
buildInputs = [ python which sphinx stdenv glibcLocales ]
++ stdenv.lib.optional enableGhostscript ghostscript
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation CoreData
cf-private libobjc ];
Expand Down Expand Up @@ -61,12 +63,9 @@ buildPythonPackage rec {
"sed -i '/self.tcl_tk_cache = None/s|None|${tcl_tk_cache}|' setupext.py";

checkPhase = ''
${python.interpreter} tests.py
'';
${python.interpreter} tests.py --no-network

# The entry point for running tests, tests.py, is not included in the release.
# https://github.com/matplotlib/matplotlib/issues/6017
doCheck = false;
'';

prePatch = ''
# Failing test: ERROR: matplotlib.tests.test_style.test_use_url
Expand All @@ -77,6 +76,19 @@ buildPythonPackage rec {
sed -i 's/test_invisible_Line_rendering/noop/' lib/matplotlib/tests/test_lines.py
'';

# Move tests in separate output
postFixup = ''
mkdir -p $tests/${python.sitePackages}/matplotlib/tests
mv $out/${python.sitePackages}/matplotlib/tests $tests/${python.sitePackages}/matplotlib/
echo "from pkgutil import extend_path; __path__ = extend_path(__path__, __name__)" >> "$out/${python.sitePackages}/matplotlib/__init__.py"
echo "from pkgutil import extend_path; __path__ = extend_path(__path__, __name__)" > "$tests/${python.sitePackages}/matplotlib/__init__.py"
mkdir -p $tests/nix-support
echo $out > $tests/nix-support/propagated-native-build-inputs
export PYTHONPATH="$tests/${python.sitePackages}:$PYTHONPATH"
'';

outputs = [ "out" "tests" ];

meta = with stdenv.lib; {
description = "Python plotting library, making publication quality plots";
homepage = "http://matplotlib.sourceforge.net/";
Expand Down