1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6 ;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
7 ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
8 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
9 ;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages python-check)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages check)
29 #:use-module (gnu packages python-web)
30 #:use-module (gnu packages python-xyz)
31 #:use-module (gnu packages web)
32 #:use-module (guix utils)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix git-download)
36 #:use-module (guix download)
37 #:use-module (guix build-system python))
39 (define-public python-coveralls
41 (name "python-coveralls")
43 (home-page "https://github.com/coveralls-clients/coveralls-python")
46 ;; The PyPI release lacks tests, so we pull from git instead.
48 (uri (git-reference (url home-page) (commit version)))
49 (file-name (git-file-name name version))
52 "1zr1lqdjcfwj6wcx2449mzzjq8bbhwnqcm5vdif5s8hlz35bjxkp"))))
53 (build-system python-build-system)
55 '(#:phases (modify-phases %standard-phases
56 (add-before 'check 'disable-git-test
58 ;; Remove test that requires 'git' and the full checkout.
59 (delete-file "tests/git_test.py")
62 (lambda* (#:key tests? #:allow-other-keys)
64 (invoke "pytest" "-vv")
65 (format #t "test suite not run~%"))
68 `(("python-coverage" ,python-coverage)
69 ("python-docopt" ,python-docopt)
70 ("python-pyyaml" ,python-pyyaml)
71 ("python-requests" ,python-requests)))
73 `(("python-mock" ,python-mock)
74 ("python-pytest" ,python-pytest)))
75 (synopsis "Show coverage stats online via coveralls.io")
77 "Coveralls.io is a service for publishing code coverage statistics online.
78 This package provides seamless integration with coverage.py (and thus pytest,
79 nosetests, etc...) in Python projects.")
80 (license license:expat)))
82 (define-public python-vcrpy
89 (uri (pypi-uri "vcrpy" version))
92 "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp"))))
93 (build-system python-build-system)
94 (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin
96 `(("python-pyyaml" ,python-pyyaml)
97 ("python-six" ,python-six)
98 ("python-wrapt" ,python-wrapt)
99 ("python-yarl" ,python-yarl)))
101 `(("python-mock" ,python-mock)
102 ("python-pytest" ,python-pytest)
103 ("python-pytest-httpbin" ,python-pytest-httpbin)))
104 (home-page "https://github.com/kevin1024/vcrpy")
105 (synopsis "Automatically mock your HTTP interactions")
107 "VCR.py simplifies and speeds up tests that make HTTP requests. The first
108 time you run code that is inside a VCR.py context manager or decorated function,
109 VCR.py records all HTTP interactions that take place through the libraries it
110 supports and serializes and writes them to a flat file (in yaml format by
111 default). This flat file is called a cassette. When the relevant piece of code
112 is executed again, VCR.py will read the serialized requests and responses from
113 the aforementioned cassette file, and intercept any HTTP requests that it
114 recognizes from the original test run and return the responses that corresponded
115 to those requests. This means that the requests will not actually result in
116 HTTP traffic, which confers several benefits including:
118 @item The ability to work offline
119 @item Completely deterministic tests
120 @item Increased test execution speed
122 If the server you are testing against ever changes its API, all you need to do
123 is delete your existing cassette files, and run your tests again. VCR.py will
124 detect the absence of a cassette file and once again record all HTTP
125 interactions, which will update them to correspond to the new API.")
126 (license license:expat)))
128 (define-public python-pytest-vcr
130 (name "python-pytest-vcr")
136 (url "https://github.com/ktosiek/pytest-vcr")
138 (file-name (git-file-name name version))
141 "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i"))))
142 (build-system python-build-system)
145 (modify-phases %standard-phases
147 (lambda* (#:key inputs outputs #:allow-other-keys)
148 (add-installed-pythonpath inputs outputs)
149 (invoke "pytest" "tests/"))))))
151 `(("python-pytest" ,python-pytest)
152 ("python-vcrpy" ,python-vcrpy)))
153 (home-page "https://github.com/ktosiek/pytest-vcr")
154 (synopsis "Plugin for managing VCR.py cassettes")
156 "Plugin for managing VCR.py cassettes.")
157 (license license:expat)))
159 (define-public python-pytest-checkdocs
161 (name "python-pytest-checkdocs")
166 (uri (pypi-uri "pytest-checkdocs" version))
168 (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0"))))
169 (build-system python-build-system)
171 `(("python-docutils" ,python-docutils)
172 ("python-importlib-metadata" ,python-importlib-metadata)
173 ("python-more-itertools" ,python-more-itertools)))
175 `(("python-setuptools-scm" ,python-setuptools-scm)))
176 (home-page "https://github.com/jaraco/pytest-checkdocs")
177 (synopsis "Check the README when running tests")
179 "This package provides a pytest plugin that checks the long description
180 of the project to ensure it renders properly.")
181 (license license:expat)))
183 (define-public python-pytest-flake8
185 (name "python-pytest-flake8")
190 (uri (pypi-uri "pytest-flake8" version))
193 "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd"))))
194 (build-system python-build-system)
196 `(("python-flake8" ,python-flake8)))
198 `(("python-pytest" ,python-pytest)))
199 (home-page "https://github.com/tholo/pytest-flake8")
200 (synopsis "Pytest plugin to check FLAKE8 requirements")
202 "This package provides a pytest plugin for efficiently checking PEP8
204 (license license:bsd-3)))
206 (define-public python-pytest-isort
208 (name "python-pytest-isort")
213 (uri (pypi-uri "pytest-isort" version))
215 (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
216 (build-system python-build-system)
219 (modify-phases %standard-phases
223 (string-append (getcwd) ":"
224 (getenv "PYTHONPATH")))
225 (invoke "pytest"))))))
227 `(("python-isort" ,python-isort)
228 ("python-pytest" ,python-pytest)))
229 (home-page "https://github.com/moccu/pytest-isort/")
230 (synopsis "Pytest plugin to check import ordering using isort")
232 "This package provides a pytest plugin to check import ordering using
234 (license license:bsd-3)))
236 (define-public python-pytest-shutil
238 (name "python-pytest-shutil")
243 (uri (pypi-uri "pytest-shutil" version))
246 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq"))))
247 (build-system python-build-system)
250 (modify-phases %standard-phases
251 (add-after 'unpack 'patch-tests
254 (substitute* "tests/integration/test_cmdline_integration.py"
255 (("dirname = '/bin'")
256 "dirname = '/tmp/bin'")
257 (("bindir = os.path.realpath\\('/bin'\\)")
258 "bindir = os.path.realpath('/tmp/bin')"))
261 `(("python-contextlib2" ,python-contextlib2)
262 ("python-execnet" ,python-execnet)
263 ("python-pathpy" ,python-pathpy)
264 ("python-termcolor" ,python-termcolor)))
266 `(("python-mock" ,python-mock)
267 ("python-pytest" ,python-pytest)
268 ("python-setuptools-git" ,python-setuptools-git)))
269 (home-page "https://github.com/manahl/pytest-plugins")
270 (synopsis "Assorted shell and environment tools for py.test")
272 "This package provides assorted shell and environment tools for the
273 py.test testing framework.")
274 (license license:expat)))
276 (define-public python-pytest-fixture-config
278 (name "python-pytest-fixture-config")
283 (uri (pypi-uri "pytest-fixture-config" version))
286 "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1"))))
287 (build-system python-build-system)
289 `(("python-pytest" ,python-pytest)
290 ("python-setuptools-git" ,python-setuptools-git)))
291 (home-page "https://github.com/manahl/pytest-plugins")
292 (synopsis "Fixture configuration utils for py.test")
294 "This package provides fixture configuration utilities for the py.test
296 (license license:expat)))
298 (define-public python-pytest-virtualenv
300 (name "python-pytest-virtualenv")
305 (uri (pypi-uri "pytest-virtualenv" version))
308 "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
309 (build-system python-build-system)
312 (modify-phases %standard-phases
313 ;; Reference the virtualenv executable directly, to avoid the need
314 ;; for PYTHONPATH, which gets cleared when instantiating a new
315 ;; virtualenv with pytest-virtualenv.
316 (add-after 'unpack 'patch-virtualenv-executable
317 (lambda* (#:key inputs #:allow-other-keys)
318 (let* ((virtualenv (assoc-ref inputs "python-virtualenv"))
319 (virtualenv-bin (string-append virtualenv
321 (substitute* "pytest_virtualenv.py"
322 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
323 (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
327 `(("python-pytest-shutil" ,python-pytest-shutil)
328 ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
330 `(("python-virtualenv" ,python-virtualenv)))
332 `(("python-mock" ,python-mock)
333 ("python-pytest" ,python-pytest)
334 ("python-setuptools-git" ,python-setuptools-git)))
335 (home-page "https://github.com/manahl/pytest-plugins")
336 (synopsis "Virtualenv fixture for py.test")
337 (description "This package provides a virtualenv fixture for the py.test
339 (license license:expat)))
341 (define-public python-pytest-pycodestyle
343 (name "python-pytest-pycodestyle")
344 (version "2.0.0") ;later versions require python-pytest~=5.4
348 (uri (pypi-uri "pytest-pycodestyle" version))
351 "02i5gl7pm9cwxk15sn29inz3n8flpj1r3p1l110h43f2na5w8h7z"))))
352 (build-system python-build-system)
354 `(("python-pycodestyle" ,python-pycodestyle)))
356 `(("python-pytest" ,python-pytest)))
357 (home-page "https://github.com/henry0312/pytest-pycodestyle")
358 (synopsis "Pytest plugin to run pycodestyle")
359 (description "This package provides a plugin to run @code{pycodestyle}
360 for the @code{pytest} framework.")
361 (license license:expat)))
363 (define-public python-codacy-coverage
365 (name "python-codacy-coverage")
370 (uri (pypi-uri "codacy-coverage" version))
373 "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr"))))
374 (build-system python-build-system)
376 `(#:tests? #f)); no tests
378 `(("python-check-manifest" ,python-check-manifest)))
379 (home-page "https://github.com/codacy/python-codacy-coverage")
380 (synopsis "Codacy coverage reporter for Python")
381 (description "This package analyses Python test suites and reports how much
382 of the code is covered by them. This tool is part of the Codacy suite for
383 analysing code quality.")
384 (license license:expat)))
386 (define-public python-httmock
388 (name "python-httmock")
393 (uri (pypi-uri "httmock" version))
396 "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0"))))
397 (build-system python-build-system)
399 `(#:tests? #f)); no tests
401 `(("python-requests" ,python-requests)))
402 (home-page "https://github.com/patrys/httmock")
403 (synopsis "Mocking library for requests.")
404 (description "This package provides a library for replying fake data to
405 Python software under test, when they make an HTTP query.")
406 (license license:asl2.0)))