diff options
Diffstat (limited to 'gnu/packages/python-check.scm')
-rw-r--r-- | gnu/packages/python-check.scm | 324 |
1 files changed, 266 insertions, 58 deletions
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index b39709d960..4888b42bc1 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm @@ -9,16 +9,18 @@ ;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com> ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net> ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org> -;;; Copyright © 2021-2023 Sharlatan Hellseher <sharlatanus@gmail.com> +;;; Copyright © 2021-2024 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot> ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com> +;;; Copyright © 2021 Sebastian Gibb <mail@sebastiangibb.de> ;;; Copyright © 2022 Malte Frank Gerdes <malte.f.gerdes@gmail.com> ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net> ;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl> ;;; Copyright © 2022 jgart <jgart@dismail.de> ;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com> ;;; Copyright © 2024 Navid Afkhami <navid.afkhami@mdc-berlin.de> +;;; Copyright © 2024 David Elsing <david.elsing@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -43,6 +45,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages django) #:use-module (gnu packages docker) + #:use-module (gnu packages jupyter) #:use-module (gnu packages openstack) #:use-module (gnu packages perl) #:use-module (gnu packages python-build) @@ -61,6 +64,38 @@ #:use-module (guix packages) #:use-module (guix utils)) +(define-public python-assay + ;; No release yet. + (let ((commit "74617d70e77afa09f58b3169cf496679ac5d5621") + (revision "0")) + (package + (name "python-assay") + (version (git-version "0.0.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/brandon-rhodes/assay") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1klxmamj88mn0q348r08zksccgsbch8sp0m4b04s3myrqnslp2nd")))) + (build-system pyproject-build-system) + (arguments + (list + #:test-flags #~(list "-m" "assay.tests") + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? test-flags #:allow-other-keys) + (when tests? + (apply invoke "python" test-flags))))))) + (home-page "https://github.com/brandon-rhodes/assay") + (synopsis "Python testing framework") + (description + "This package provides opiniotated Python test framework prototype.") + (license license:expat)))) + (define-public python-assertpy (package (name "python-assertpy") @@ -192,6 +227,48 @@ CSV output mode for Pytest. It can be enabled via the @option{--csv} option it adds to the Pytest command line interface (CLI).") (license license:gpl3+))) +(define-public python-pytest-flakefinder + (package + (name "python-pytest-flakefinder") + (version "1.1.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pytest-flakefinder" version)) + (sha256 + (base32 "03iy80xlkpgzjs2kxa9rrj8dbnp9awyhpcl3hy8fgf5x40cjlhg2")))) + (build-system pyproject-build-system) + (propagated-inputs (list python-pytest)) + (home-page "https://github.com/dropbox/pytest-flakefinder") + (synopsis "Pytest plugin for finding flaky tests") + (description "This package provides a Pytest plugin to run tests multiple +times and detect flakyness.") + (license license:asl2.0))) + +(define-public python-pytest-shard + (let ((commit "64610a08dac6b0511b6d51cf895d0e1040d162ad") + (revision "0")) + (package + (name "python-pytest-shard") + (version (git-version "0.1.2" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/AdamGleave/pytest-shard") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1h31m68igz670bzl307hazjrfbr8pk14mxflllar18ydmlrnl677")))) + (build-system pyproject-build-system) + (propagated-inputs (list python-pytest)) + (home-page "https://github.com/AdamGleave/pytest-shard") + (synopsis "Pytest plugin for sharding tests") + (description "This package provides a Pytest extension for sharding +tests at the granularity of individual test cases, which can be run in +parallel and on multiple machines.") + (license license:expat)))) + (define-public python-testfixtures (package (name "python-testfixtures") @@ -420,13 +497,17 @@ interactions, which will update them to correspond to the new API.") (define-public python-pytest-socket (package (name "python-pytest-socket") - (version "0.5.1") - (source (origin - (method url-fetch) - (uri (pypi-uri "pytest-socket" version)) - (sha256 - (base32 - "1dkr86nxkxc0ka3rdnpmk335m8gl1zh1sy8i7w4w1jsidbf82jvw")))) + (version "0.7.0") + (source + (origin + ;; There are no tests in the PyPI tarball. + (method git-fetch) + (uri (git-reference + (url "https://github.com/miketheman/pytest-socket") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1m6s07gvljq82hiajzy1v123kpkciziiqdjqfnas169rmzg0bmnp")))) (build-system pyproject-build-system) (arguments (list @@ -440,7 +521,18 @@ interactions, which will update them to correspond to the new API.") " and not test_httpx_fails" " and not test_disabled_urllib_fails" " and not test_urllib_succeeds_by_default" - " and not test_enabled_urllib_succeeds")))) + " and not test_enabled_urllib_succeeds" + " and not test_single_cli_arg_connect_disabled_hostname_resolved")) + #:phases + #~(modify-phases %standard-phases + ;; See <https://github.com/miketheman/pytest-socket/issues/308> + (add-after 'unpack 'fix-tests + (lambda _ + (substitute* (list "tests/test_async.py" + "tests/test_socket.py" + "tests/test_precedence.py") + (("from tests.common import assert_socket_blocked") + "from common import assert_socket_blocked"))))))) (native-inputs (list python-httpx python-poetry-core python-pypa-build @@ -607,6 +699,29 @@ your template is working as expected and takes care of cleaning up after running the tests.") (license license:expat))) +(define-public python-pytest-datafiles + (package + (name "python-pytest-datafiles") + (version "3.0.0") + (source + (origin + (method git-fetch) ; no tests in the PyPI tarball + (uri (git-reference + (url "https://github.com/omarkohl/pytest-datafiles") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1wbgfsn4pcdm0bw61pwaaq707mlfnixlff3x8m5mpsf6jhrzql30")))) + (build-system pyproject-build-system) + (native-inputs + (list python-pytest)) + (home-page "https://github.com/omarkohl/pytest-datafiles") + (synopsis "Pytest plugin to create a tmpdir") + (description + "A pytest plugin to create a tmpdir containing a preconfigured set of +files and/or directories.") + (license license:expat))) + (define-public python-pytest-doctestplus (package (name "python-pytest-doctestplus") @@ -749,22 +864,14 @@ access to test session metadata.") (define-public python-pytest-openfiles (package (name "python-pytest-openfiles") - (version "0.5.0") + (version "0.6.0") (source (origin (method url-fetch) - (uri (pypi-uri "pytest-openfiles" version)) + (uri (pypi-uri "pytest_openfiles" version)) (sha256 - (base32 "0n0a7fdc9m86360y96l23fvdmd6rw04bl6h5xqgl9qxfv08jk70p")))) - (build-system python-build-system) - (arguments - '(#:phases - (modify-phases %standard-phases - (replace 'check - (lambda* (#:key inputs outputs #:allow-other-keys) - ;; Make the installed plugin discoverable by Pytest. - (add-installed-pythonpath inputs outputs) - (invoke "pytest" "-vv")))))) + (base32 "14x9f1l9a5ghf527i5qfcfa003mkrky1dhx2hfwq5nma9v1n0lgz")))) + (build-system pyproject-build-system) (native-inputs (list python-setuptools-scm python-pytest)) (propagated-inputs @@ -1134,22 +1241,17 @@ simpler.") (uri (pypi-uri "pytest-trio" version)) (sha256 (base32 "0c8cqf9by2884riksrqymqfp2g1d2d798a2zalcw9hmf34c786y0")))) - (build-system python-build-system) + (build-system pyproject-build-system) (arguments - `(#:phases - (modify-phases %standard-phases - (replace 'check - (lambda* (#:key tests? inputs outputs #:allow-other-keys) - (when tests? - (add-installed-pythonpath inputs outputs) - (invoke "pytest" "-W" "error" "-ra" "-v" "--pyargs" - "pytest_trio" "--verbose" "--cov" "-k" - (string-append - ;; Needs network - "not test_async_yield_fixture_with_nursery" - " and not test_try" - ;; No keyboard interrupt in our build environment. - " and not test_actual_test")))))))) + (list + #:test-flags '(list "-W" "error" "-ra" "-v" "--pyargs" + "pytest_trio" "--verbose" "--cov" "-k" + (string-append + ;; Needs network + "not test_async_yield_fixture_with_nursery" + " and not test_try" + ;; No keyboard interrupt in our build environment. + " and not test_actual_test")))) (native-inputs (list python-hypothesis python-pytest python-pytest-cov)) (propagated-inputs @@ -1218,16 +1320,19 @@ isort.") (sha256 (base32 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq")))) - (build-system python-build-system) + (build-system pyproject-build-system) (arguments - `(#:phases - (modify-phases %standard-phases + (list + #:test-flags + ;; This test is sensitive to generated terminal escape codes. + '(list "-k" "not test_pretty_formatter") + #:phases + '(modify-phases %standard-phases (add-after 'unpack 'use-path-instead-of-path.py ;; path.py is obsolete. (lambda _ (substitute* "setup.py" - (("'path.py'") - "'path'")))) + (("'path.py'") "'path'")))) (add-after 'unpack 'patch-tests (lambda _ (mkdir "/tmp/bin") @@ -1468,16 +1573,49 @@ new fixtures, new methods and new comparison objects.") (description "This package provides a pytest plugin for aiohttp support.") (license license:asl2.0))) +(define-public python-nbmake + (package + (name "python-nbmake") + (version "1.5.3") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/treebeardtech/nbmake") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "06syl819kwqhmjwp34lri31f0pypwnxs9j03s5lbk12w42mihzdi")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + '(modify-phases %standard-phases + (add-before 'check 'set-HOME + (lambda _ (setenv "HOME" "/tmp")))))) + (propagated-inputs + (list python-ipykernel python-nbclient python-nbformat python-pygments)) + (native-inputs + (list python-poetry-core + python-pytest + python-pytest-xdist + python-pyyaml)) + (home-page "https://github.com/treebeardtech/nbmake") + (synopsis "Pytest plugin for testing notebooks") + (description "This package provides a Pytest plugin for testing Jupyter +notebooks.") + (license license:asl2.0))) + (define-public python-nbval (package (name "python-nbval") - (version "0.9.6") + (version "0.11.0") (source (origin (method url-fetch) (uri (pypi-uri "nbval" version)) (sha256 - (base32 "0h3xrnw0mj1srigrx2rfnd73h8s0xjycclmjs0vx7qkfyqpcvvyg")))) + (base32 "154h6xpf9h6spgg3ax6k79fd40j197ipwnfjmf5rc2kvc2bmgjbp")))) (build-system python-build-system) (arguments `(#:phases @@ -1491,21 +1629,16 @@ new fixtures, new methods and new comparison objects.") (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (invoke "pytest" "-vv" "-k" - (string-append - ;; This only works with Pytest < 5. - "not nbdime_reporter" - ;; https://github.com/computationalmodelling/nbval/pull/148. - " and not test_timeouts" - ;; It seems the output format has changed; the following - ;; test fails with "Unexpected output fields from - ;; running code: {'text/plain'}". - " and not test_conf_ignore_stderr ")))))))) - (native-inputs - (list python-pytest python-pytest-cov python-sympy)) + (invoke "pytest" "-vv" + ;; nbdime forms a dependency cycle + "--ignore=tests/test_nbdime_reporter.py"))))))) + (native-inputs (list python-pytest-cov python-sympy)) (propagated-inputs - (list python-ipykernel python-jupyter-client python-nbformat - python-six)) + (list python-coverage + python-ipykernel + python-jupyter-client + python-nbformat + python-pytest)) (home-page "https://github.com/computationalmodelling/nbval") (synopsis "Pytest plugin to validate Jupyter notebooks") (description @@ -2066,6 +2199,41 @@ from Python files. It does this by detecting block comments that contain valid Python syntax that are likely to be commented out code.") (license license:expat))) +(define-public python-expecttest + (let ((commit "683b09a352cc426851adc2e3a9f46e0ab25e4dee") + (revision "0")) + (package + (name "python-expecttest") + (version (git-version "0.2.1" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ezyang/expecttest") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1djwxp9x1hczzxbimv1b1bmd083am88v27l82nmlkhvzyg2cmpvv")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; The test runs tests expected to fail, so the output is + ;; confusing + (invoke "python3" "test_expecttest.py"))))))) + (native-inputs (list python-hypothesis poetry)) + (home-page "https://github.com/ezyang/expecttest") + (synopsis "Python module for expect tests") + (description "@code{expecttest} is a Python module for expect tests, where +the initial expected value of a test can be automatically set by running the +test itself.") + (license license:expat)))) + (define-public python-robber (package (name "python-robber") @@ -2148,6 +2316,35 @@ execution of a test suite. It will also store a history of all test runs to help in debugging failures and optimizing the scheduler to improve speed.") (license license:asl2.0))) +(define-public python-pytest-subprocess + (package + (name "python-pytest-subprocess") + (version "1.5.0") + (source + (origin + (method git-fetch) ;no tests in PyPI archive + (uri (git-reference + (url "https://github.com/aklajnert/pytest-subprocess") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "103nxv37sjvxlwmw87hxsrphkxkryv4dgb65kjjfr4722r37vmxv")))) + (build-system pyproject-build-system) + (native-inputs (list python-anyio + python-coverage + python-docutils + python-nox + python-pygments + python-pytest + python-pytest-asyncio + python-pytest-rerunfailures)) + (home-page "https://github.com/aklajnert/pytest-subprocess") + (synopsis "Fake subprocess for Pytest") + (description + "This package provides a plugin to fake subprocess for Pytest.") + (license license:expat))) + ;; This is only used by python-sanic (define-public python-pytest-sanic (package @@ -2172,7 +2369,7 @@ help in debugging failures and optimizing the scheduler to improve speed.") (lambda _ (substitute* "setup.py" (("websockets.*<11.0") - "websockets<12.0"))))))) + "websockets<13.0"))))))) (propagated-inputs (list python-httpx python-async-generator python-pytest python-websockets)) @@ -2417,6 +2614,17 @@ in an opinionated way.") eliminate flaky failures.") (license license:mpl2.0))) +(define-public python-pytest-rerunfailures-13 + (package + (inherit python-pytest-rerunfailures) + (version "13.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pytest-rerunfailures" version)) + (sha256 + (base32 "16cin0chv59w4rvnd6r0fisp0s8avmp07rwn9da6yixw43jdncp1")))))) + (define-public python-xunitparser (package (name "python-xunitparser") |