From 8d870bebc17435e3f28215c79c0c8b077a92c30e Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Tue, 2 Dec 2025 10:15:52 +0000 Subject: [PATCH] gnu: python-pynose: Improve package. * gnu/packages/python-check.scm (python-pynose): [arguments] : Use custom 'check. [native-inputs]: Remove python-wheel. [synopsis]: Adjust it to reflect the logic. [description]: Add more details from proejct's README and mention that it may be used as Nose replacement. Change-Id: Ib5b35803d8e5240433a86f57423d28691ec696e8 --- gnu/packages/python-check.scm | 40 ++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index ea2a0006f56a1e4bcd11b15dce6dc784674a8ba8..07f67362c6a0ff442db4e0050a9ceb8667e4c641 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm @@ -2104,11 +2104,45 @@ among others.") (sha256 (base32 "0jbzmxnxmgf60158gpvfsp8j2cid6psfwj3j94vxv61z8wk4xnl1")))) (build-system pyproject-build-system) - (native-inputs (list python-setuptools python-wheel)) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (replace 'check + ;; A simple regression tests, taken from project's GitHub Actions, + ;; see: <.github/workflows/python-package.yml>. + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (with-output-to-file "nothing.py" + (const (display "def test_1(): pass\n"))) + (invoke "pynose" "nothing.py" "--co" "-v") + (invoke "pynose" "nothing.py" "-v") + (invoke "nosetests" "nothing.py" "--co" "-v") + (invoke "nosetests" "nothing.py" "-v") + (delete-file "nothing.py"))))))) + (native-inputs + (list python-setuptools)) (home-page "https://github.com/mdmintz/pynose") - (synopsis "pynose fixes nose to extend unittest and make testing easier") + (synopsis "Unittest framework for Python") (description - "pynose fixes nose to extend unittest and make testing easier.") + "@code{pynose} is a maintained successor of deprecated @code{nose} unittest +runner. +Changes over @code{nose}: +@itemize +@item fixes @code{AttributeError: module 'collections' has no attribute 'Callable'} +@item fixes @code{AttributeError: module 'inspect' has no attribute 'getargspec'} +@item fixes @code{ImportError: cannot import name '_TextTestResult' from 'unittest'} +@item fixes @code{RuntimeWarning: TestResult has no addDuration method} +@item fixes @code{DeprecationWarning: pkg_resources is deprecated as an API} +@item fixes all @code{flake8} issues from the original nose +@item replaces the imp module with the newer importlib module +@item the default logging level now hides @code{INFO} logs for less noise +@item adds @code{--capture-logs} for hiding output from all logging levels +@item adds @code{--logging-init} to use @code{logging.basicConfig(level)} +@item the @code{-s} option is always active to see the output of @code{print()} +@item adds @code{--capture-output} for hiding the output of @code{print()} +@item adds @code{--co} as a shortcut to using @code{--collect-only} +@end itemize") (license license:lgpl2.0))) (define-public python-pytest-aiohttp