[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/12: gnu: python-nbconvert: Enable more tests.
From: |
guix-commits |
Subject: |
11/12: gnu: python-nbconvert: Enable more tests. |
Date: |
Mon, 26 Apr 2021 04:37:52 -0400 (EDT) |
lbraun pushed a commit to branch master
in repository guix.
commit d57341234d66ba71618ed401d8bb0a5986dc22db
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Tue Apr 20 11:03:55 2021 +0200
gnu: python-nbconvert: Enable more tests.
Enables more tests and fixes a few paths.
* gnu/packages/python-xyz.scm (python-nbconvert) [arguments]: Add new
phase, fixing pandoc/LaTeX paths. Set required environment variables in
'check phase.
[inputs]: Add pandoc and texlive.
[native-inputs]: Add missing inputs for tests.
[propagated-inputs]: Add tornado, which is always required.
---
gnu/packages/python-xyz.scm | 76 ++++++++++++++++++++++++++++++++-------------
1 file changed, 55 insertions(+), 21 deletions(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ace191e..3942135 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -10665,32 +10665,64 @@ time.")
(arguments
`(#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths-and-tests
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((pandoc (string-append (assoc-ref inputs "pandoc")
"/bin/pandoc"))
+ (texlive-root (string-append (assoc-ref inputs "texlive")))
+ (xelatex (string-append texlive-root "/bin/xelatex"))
+ (bibtex (string-append texlive-root "/bin/bibtex")))
+ ;; Use pandoc binary from input.
+ (substitute* "nbconvert/utils/pandoc.py"
+ (("'pandoc'") (string-append "'" pandoc "'")))
+ ;; Same for LaTeX.
+ (substitute* "nbconvert/exporters/pdf.py"
+ (("\"xelatex\"") (string-append "\"" xelatex "\""))
+ (("\"bibtex\"") (string-append "\"" bibtex "\"")))
+ ;; Make sure tests are not skipped.
+ (substitute* (find-files "." "test_.+\\.py$")
+ (("@onlyif_cmds_exist\\(('(pandoc|xelatex)'(, )?)+\\)") ""))
+ ;; Pandoc is never missing, disable test.
+ (substitute* "nbconvert/utils/tests/test_pandoc.py"
+ (("import os" all) (string-append all "\nimport pytest"))
+ (("(.+)(def test_pandoc_available)" all indent def)
+ (string-append indent "@pytest.mark.skip('disabled by guix')\n"
+ indent def)))
+ ; Not installing pyppeteer, delete test.
+ (delete-file "nbconvert/exporters/tests/test_webpdf.py")
+ (substitute* "nbconvert/tests/test_nbconvertapp.py"
+ (("(.+)(def test_webpdf_with_chromium)" all indent def)
+ (string-append indent "@pytest.mark.skip('disabled by guix')\n"
+ indent def)))
+ #t)))
(replace 'check
(lambda* (#:key tests? inputs outputs #:allow-other-keys)
(when tests?
+ ;; Some tests invoke the installed nbconvert binary.
(add-installed-pythonpath inputs outputs)
-
- ;; This seems to require Chromium.
- (delete-file "nbconvert/exporters/tests/test_webpdf.py")
-
- ;; This depends on the python3 kernel, which is provided by a
- ;; package that depends on nbconvert.
- (delete-file "nbconvert/preprocessors/tests/test_execute.py")
-
- ;; Most of these tests fail because nbconvert fails to execute
- ;; itself.
- (delete-file "nbconvert/tests/test_nbconvertapp.py")
-
- ;; One test here fails with an unclear error. It looks like
- ;; "%%pylabprint" is supposed to be expanded to some other
- ;; code, but isn't.
- (delete-file "nbconvert/filters/tests/test_strings.py")
-
+ ;; Tries to write to this path.
+ (unsetenv "JUPYTER_CONFIG_DIR")
+ ;; Tests depend on templates installed to output.
+ (setenv "JUPYTER_PATH"
+ (string-append
+ (assoc-ref outputs "out")
+ "/share/jupyter:"
+ (getenv "JUPYTER_PATH")))
;; Some tests need HOME
(setenv "HOME" "/tmp")
- (invoke "pytest")))))))
- (native-inputs
- `(("python-pytest" ,python-pytest)))
+ (invoke "pytest" "-vv")))))))
+ (inputs
+ `(("pandoc" ,pandoc)
+ ; XXX: Disabled, needs substitute*.
+ ;("inkscape" ,inkscape)
+ ("texlive" ,texlive)))
+ (native-inputs
+ `(("python-ipykernel" ,python-ipykernel)
+ ; XXX: Disabled, not in guix.
+ ;("python-pyppeteer" ,python-pyppeteer)
+ ("python-pytest" ,python-pytest)
+ ("python-pytest-cov" ,python-pytest-cov)
+ ("python-pytest-dependency"
+ ,python-pytest-dependency)))
(propagated-inputs
`(("python-bleach" ,python-bleach)
("python-defusedxml" ,python-defusedxml)
@@ -10704,7 +10736,9 @@ time.")
("python-pygments" ,python-pygments)
("python-jupyterlab-pygments" ,python-jupyterlab-pygments)
("python-testpath" ,python-testpath)
- ("python-traitlets" ,python-traitlets)))
+ ("python-traitlets" ,python-traitlets)
+ ;; Required, even if [serve] is not used.
+ ("python-tornado" ,python-tornado-6)))
(home-page "https://jupyter.org")
(synopsis "Converting Jupyter Notebooks")
(description "The @code{nbconvert} tool, @{jupyter nbconvert}, converts
- branch master updated (2ff36e4 -> 2209e5c), guix-commits, 2021/04/26
- 01/12: gnu: Move search path JUPYTER_PATH., guix-commits, 2021/04/26
- 02/12: gnu: python-jupyter-core: Enable tests., guix-commits, 2021/04/26
- 05/12: gnu: python-nbformat: Enable tests., guix-commits, 2021/04/26
- 06/12: gnu: Add python-jupyter-client-bootstrap., guix-commits, 2021/04/26
- 07/12: gnu: Add python-ipykernel-bootstrap., guix-commits, 2021/04/26
- 10/12: gnu: Add python-pytest-dependency., guix-commits, 2021/04/26
- 11/12: gnu: python-nbconvert: Enable more tests.,
guix-commits <=
- 08/12: gnu: python-jupyter-client: Enable tests., guix-commits, 2021/04/26
- 03/12: gnu: Add python-json-spec., guix-commits, 2021/04/26
- 04/12: gnu: Add python-fastjsonschema., guix-commits, 2021/04/26
- 09/12: gnu: python-ipykernel: Add missing inputs., guix-commits, 2021/04/26
- 12/12: gnu: python-notebook: Fix tests., guix-commits, 2021/04/26