gnu: python-pexpect: Improve package style.

* gnu/packages/python-xyz.scm (python-pexpect): Use G-expression,
improve style.
[build-system]: Swap to pyproject-build-system.
[arguments]<test-flags>: Move test exclusion logic here from
'prepare-tests phase.
[native-inputs]: Remove python-nose; add python-setuptools and
python-wheel.

Change-Id: I16da2bfbeabf21b02acf93f7fed765f262a56596
This commit is contained in:
Sharlatan Hellseher 2024-11-16 19:58:29 +00:00
parent 8d5f2d7647
commit 3daf5b0dcf
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -11833,43 +11833,55 @@ wraps Python's standard library threading and multiprocessing objects.")
(uri (pypi-uri "pexpect" version)) (uri (pypi-uri "pexpect" version))
(sha256 (sha256
(base32 "032cg337h8awydgypz6f4wx848lw8dyrj4zy988x0lyib4ws8rgw")))) (base32 "032cg337h8awydgypz6f4wx848lw8dyrj4zy988x0lyib4ws8rgw"))))
(build-system python-build-system) (build-system pyproject-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:test-flags
(add-before 'check 'prepare-tests #~(list "-k" (string-join
(lambda _ (list
(substitute* (find-files "tests") ;; Disable failing test, see
(("/bin/ls") (which "ls")) ;; <https://github.com/pexpect/pexpect/issues/568>.
(("/bin/echo") (which "echo")) "not test_bash"
(("/bin/which") (which "which")) ;; Fails with attempt to find OpenSSL.
;; Many tests try to use the /bin directory which "test_large_stdout_stream"
;; is not present in the build environment. ;; Tests fail while trying to find
;; Use one that's non-empty and unlikely to change. ;; tmp-pexpect-xxxxxxxxxxxx directories.
(("/bin'") "/dev'") "test_run_uses_env"
;; Disable failing test. See upstream bug report "test_run_uses_env_path"
;; https://github.com/pexpect/pexpect/issues/568 "test_run_uses_env_path_over_path"
(("def test_bash") "def _test_bash")) "test_spawn_uses_env"
;; XXX: Socket connection test gets "Connection reset by peer". ;; Fails with assertion error: assert 0 == 500
;; Why does it not work? Delete for now. "test_before_across_chunks")
(delete-file "tests/test_socket.py") " and not "))
#t)) #:phases
(replace 'check (lambda _ (invoke "nosetests" "-v")))))) #~(modify-phases %standard-phases
(add-before 'check 'prepare-tests
(lambda _
(substitute* (find-files "tests")
(("/bin/bash") (which "bash"))
(("/bin/echo") (which "echo"))
(("/bin/ls") (which "ls"))
(("/bin/which") (which "which"))
;; Many tests try to use the /bin directory which is not
;; present in the build environment. Use one that's non-empty
;; and unlikely to change.
(("/bin'") "/dev'")))))))
(native-inputs (native-inputs
`(("python-nose" ,python-nose) (list bash ;full Bash for 'test_replwrap.py'
("python-pytest" ,python-pytest) man-db
("man-db" ,man-db) python-pytest
("which" ,which) python-setuptools
("bash-full" ,bash))) ;full Bash for 'test_replwrap.py' python-wheel
which))
(propagated-inputs (propagated-inputs
(list python-ptyprocess)) (list python-ptyprocess))
(home-page "https://pexpect.readthedocs.org/") (home-page "https://pexpect.readthedocs.org/")
(synopsis "Controlling interactive console applications") (synopsis "Controlling interactive console applications")
(description (description
"Pexpect is a pure Python module for spawning child applications; "Pexpect is a pure Python module for spawning child applications;
controlling them; and responding to expected patterns in their output. controlling them; and responding to expected patterns in their output. Pexpect
Pexpect works like Don Libes Expect. Pexpect allows your script to spawn a works like Don Libes Expect. Pexpect allows your script to spawn a child
child application and control it as if a human were typing commands.") application and control it as if a human were typing commands.")
(license license:isc))) (license license:isc)))
(define-public python-sexpdata (define-public python-sexpdata