summary refs log tree commit diff
path: root/gnu/packages/python-science.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-04-18 15:27:38 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-05-12 12:45:55 -0400
commit8b390a8750b9d47924cdb49d3459668f0703fcea (patch)
tree52d46073bbe9c4b67a3659d331ec365812e2f7c3 /gnu/packages/python-science.scm
parentfeee911366d3da00c0872f46944c36a7d12859b3 (diff)
downloadguix-8b390a8750b9d47924cdb49d3459668f0703fcea.tar.gz
gnu: python-pandas: Build and run tests in parallel.
* gnu/packages/python-science.scm (python-pandas)
[phases]{enable-parallel-build}: New phase.
{check}: Add xdist -n option.  Skip test_memory_usage test.
[native-inputs]: Add python-pytest-xdist.
Diffstat (limited to 'gnu/packages/python-science.scm')
-rw-r--r--gnu/packages/python-science.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 2cabdb490c..21ed2c7694 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -413,6 +413,12 @@ library.")
                   (srfi srfi-26))
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'enable-parallel-build
+           (lambda _
+             (substitute* "setup.py"
+               (("\"-j\", type=int, default=1")
+                (format #f "\"-j\", type=int, default=~a"
+                        (parallel-job-count))))))
          (add-after 'unpack 'patch-which
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((which (assoc-ref inputs "which")))
@@ -439,6 +445,7 @@ library.")
                  (when tests?
                    (invoke "pytest" "-vv" "pandas" "--skip-slow"
                            "--skip-network"
+                           "-n" (number->string (parallel-job-count))
                            "-k"
                            (string-append
                             ;; These test access the internet (see:
@@ -448,7 +455,11 @@ library.")
                             "not test_wrong_url"
                             ;; TODO: Missing input
                             " and not TestS3"
-                            " and not s3"))))))))))
+                            " and not s3"
+                            ;; This test fails when run with pytest-xdist
+                            ;; (see:
+                            ;; https://github.com/pandas-dev/pandas/issues/39096).
+                            " and not test_memory_usage"))))))))))
     (propagated-inputs
      (list python-jinja2
            python-numpy
@@ -466,6 +477,7 @@ library.")
            python-html5lib
            python-pytest
            python-pytest-mock
+           python-pytest-xdist
            ;; Needed to test clipboard support.
            xorg-server-for-tests))
     (home-page "https://pandas.pydata.org")