gnu: xonsh: Enable tests.

* gnu/packages/shells.scm (xonsh)[arguments]: Remove #:tests?. Skip failing
tests in #:test-flags?. Add phase 'writable-home before 'check.
[native-inputs]: Add git-minimal, python-pyte, python-pytest,
python-pytest-mock, python-pytest-rerunfailures, python-pytest-subprocess,
python-pytest-timeout, python-requests.

Change-Id: Iba35db554b1536246efbd101d9d588f7007fb885
This commit is contained in:
Vinicius Monego 2024-07-06 14:11:54 -03:00
parent 4b3b80f57c
commit 5dad9f6701
No known key found for this signature in database
GPG key ID: 637B0B138065B68A

View file

@ -47,6 +47,7 @@ (define-module (gnu packages shells)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bison)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages crates-crypto)
#:use-module (gnu packages crates-graphics)
@ -66,11 +67,14 @@ (define-module (gnu packages shells)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-check)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
#:use-module (gnu packages rust)
#:use-module (gnu packages rust-apps)
#:use-module (gnu packages scheme)
#:use-module (gnu packages terminals)
#:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (gnu packages xdisorg)
@ -576,10 +580,36 @@ (define-public xonsh
#t))))
(build-system pyproject-build-system)
(arguments
(list ;; TODO Try running run the test suite.
;; See 'requirements-tests.txt' in the source distribution for more
;; information.
#:tests? #f
;; Some tests are failing for reasons like not accessing parent directory
;; with os.getcwd(), not activating virtual environments, not finding
;; some commands (man, echo), and not running subprocesses.
(list #:test-flags
#~(list "-k"
(string-append
"not "
(string-join
(list "test_aliases_print"
"test_argv0"
"test_bash_and_is_alias_is_only_functional_alias"
"test_bash_completer"
"test_bash_completer_empty_prefix"
"test_complete_command"
"test_complete_dots"
"test_dirty_working_directory"
"test_equal_sign_arg"
"test_man_completion"
"test_parser_show"
"test_printfile"
"test_printname"
"test_quote_handling"
"test_script"
"test_skipper_command"
"test_sourcefile"
"test_spec_modifier_alias_output_format"
"test_vc_get_branch"
"test_xonsh_activator"
"test_xonsh_lexer")
" and not ")))
#:phases
#~(modify-phases %standard-phases
(replace 'install
@ -588,9 +618,21 @@ (define-public xonsh
(invoke "python" "-m" "compileall"
"--invalidation-mode=unchecked-hash" out)
(invoke "python" "setup.py" "install" "--root=/"
(string-append "--prefix=" out))))))))
(string-append "--prefix=" out)))))
;; Some tests run os.mkdir().
(add-before 'check 'writable-home
(lambda _
(setenv "HOME" "/tmp"))))))
(native-inputs
(list python-setuptools ;needed at build time
(list git-minimal
python-pyte
python-pytest
python-pytest-mock
python-pytest-rerunfailures
python-pytest-subprocess
python-pytest-timeout
python-requests
python-setuptools ;needed at build time
python-wheel))
(inputs
(list python-distro