me
/
guix
Archived
1
0
Fork 0

gnu: python-notebook: Fix tests that rely on the gio "trash" mechanism.

Previously 'test_delete' and a couple of related tests in
'test_content_api.py' would fail:

  https://lists.gnu.org/archive/html/guix-devel/2021-11/msg00083.html

Reported by Ricardo Wurmus.

* gnu/packages/python-xyz.scm (python-notebook)[arguments]: Add
'use-our-home-for-tests' phase.  In 'check' phase, remove call to
'setenv' and unnecessary use of 'with-directory-excursion'.
master
Ludovic Courtès 2021-11-19 21:27:18 +01:00
parent d55ed2725e
commit 7c9801e857
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 16 additions and 7 deletions

View File

@ -12051,6 +12051,18 @@ convert an @code{.ipynb} notebook file into various static formats including:
(arguments (arguments
`(#:phases `(#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-after 'unpack 'use-our-home-for-tests
(lambda _
;; The 'get_patch_env' function in this file reads:
;; 'HOME': cls.home_dir
;; but for some reason, that definition of HOME is not what the
;; GLib/GIO trash mechanism honors, which would cause test
;; failures. Instead, set 'HOME' here to an existing directory
;; and let the tests honor it.
(substitute* "notebook/tests/launchnotebook.py"
(("'HOME': .*," all)
(string-append "# " all "\n")))
(setenv "HOME" (getcwd))))
(replace 'check (replace 'check
(lambda* (#:key tests? inputs outputs #:allow-other-keys) (lambda* (#:key tests? inputs outputs #:allow-other-keys)
;; These tests require a browser ;; These tests require a browser
@ -12060,13 +12072,10 @@ convert an @code{.ipynb} notebook file into various static formats including:
;; Some tests do not expect all files to be installed in the ;; Some tests do not expect all files to be installed in the
;; same directory, but JUPYTER_PATH contains multiple entries. ;; same directory, but JUPYTER_PATH contains multiple entries.
(unsetenv "JUPYTER_PATH") (unsetenv "JUPYTER_PATH")
;; Some tests need HOME (invoke "pytest" "-vv"
(setenv "HOME" "/tmp") ;; TODO: This tests fails because nbconvert does not
(with-directory-excursion "/tmp" ;; list "python" as a format.
(invoke "pytest" "-vv" "-k" "not test_list_formats")))))))
;; TODO: This tests fails because nbconvert does not
;; list "python" as a format.
"-k" "not test_list_formats"))))))))
(propagated-inputs (propagated-inputs
`(("python-argon2-cffi" ,python-argon2-cffi) `(("python-argon2-cffi" ,python-argon2-cffi)
("python-ipykernel" ,python-ipykernel) ("python-ipykernel" ,python-ipykernel)