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>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages python-check)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages check)
28 #:use-module (gnu packages python-web)
29 #:use-module (gnu packages python-xyz)
30 #:use-module (gnu packages web)
31 #:use-module (guix utils)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix git-download)
35 #:use-module (guix download)
36 #:use-module (guix build-system python))
38 (define-public python-coveralls
40 (name "python-coveralls")
42 (home-page "https://github.com/coveralls-clients/coveralls-python")
45 ;; The PyPI release lacks tests, so we pull from git instead.
47 (uri (git-reference (url home-page) (commit version)))
48 (file-name (git-file-name name version))
51 "1zr1lqdjcfwj6wcx2449mzzjq8bbhwnqcm5vdif5s8hlz35bjxkp"))))
52 (build-system python-build-system)
54 '(#:phases (modify-phases %standard-phases
55 (add-before 'check 'disable-git-test
57 ;; Remove test that requires 'git' and the full checkout.
58 (delete-file "tests/git_test.py")
61 (lambda* (#:key tests? #:allow-other-keys)
63 (invoke "pytest" "-vv")
64 (format #t "test suite not run~%"))
67 `(("python-coverage" ,python-coverage)
68 ("python-docopt" ,python-docopt)
69 ("python-pyyaml" ,python-pyyaml)
70 ("python-requests" ,python-requests)))
72 `(("python-mock" ,python-mock)
73 ("python-pytest" ,python-pytest)))
74 (synopsis "Show coverage stats online via coveralls.io")
76 "Coveralls.io is a service for publishing code coverage statistics online.
77 This package provides seamless integration with coverage.py (and thus pytest,
78 nosetests, etc...) in Python projects.")
79 (license license:expat)))
81 (define-public python-vcrpy
88 (uri (pypi-uri "vcrpy" version))
91 "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp"))))
92 (build-system python-build-system)
93 (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin
95 `(("python-pyyaml" ,python-pyyaml)
96 ("python-six" ,python-six)
97 ("python-wrapt" ,python-wrapt)
98 ("python-yarl" ,python-yarl)))
100 `(("python-mock" ,python-mock)
101 ("python-pytest" ,python-pytest)
102 ("python-pytest-httpbin" ,python-pytest-httpbin)))
103 (home-page "https://github.com/kevin1024/vcrpy")
104 (synopsis "Automatically mock your HTTP interactions")
106 "VCR.py simplifies and speeds up tests that make HTTP requests. The first
107 time you run code that is inside a VCR.py context manager or decorated function,
108 VCR.py records all HTTP interactions that take place through the libraries it
109 supports and serializes and writes them to a flat file (in yaml format by
110 default). This flat file is called a cassette. When the relevant piece of code
111 is executed again, VCR.py will read the serialized requests and responses from
112 the aforementioned cassette file, and intercept any HTTP requests that it
113 recognizes from the original test run and return the responses that corresponded
114 to those requests. This means that the requests will not actually result in
115 HTTP traffic, which confers several benefits including:
117 @item The ability to work offline
118 @item Completely deterministic tests
119 @item Increased test execution speed
121 If the server you are testing against ever changes its API, all you need to do
122 is delete your existing cassette files, and run your tests again. VCR.py will
123 detect the absence of a cassette file and once again record all HTTP
124 interactions, which will update them to correspond to the new API.")
125 (license license:expat)))
127 (define-public python-pytest-vcr
129 (name "python-pytest-vcr")
135 (url "https://github.com/ktosiek/pytest-vcr")
137 (file-name (git-file-name name version))
140 "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i"))))
141 (build-system python-build-system)
144 (modify-phases %standard-phases
146 (lambda* (#:key inputs outputs #:allow-other-keys)
147 (add-installed-pythonpath inputs outputs)
148 (invoke "pytest" "tests/"))))))
150 `(("python-pytest" ,python-pytest)
151 ("python-vcrpy" ,python-vcrpy)))
152 (home-page "https://github.com/ktosiek/pytest-vcr")
153 (synopsis "Plugin for managing VCR.py cassettes")
155 "Plugin for managing VCR.py cassettes.")
156 (license license:expat)))
158 (define-public python-pytest-checkdocs
160 (name "python-pytest-checkdocs")
165 (uri (pypi-uri "pytest-checkdocs" version))
167 (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0"))))
168 (build-system python-build-system)
170 `(("python-docutils" ,python-docutils)
171 ("python-importlib-metadata" ,python-importlib-metadata)
172 ("python-more-itertools" ,python-more-itertools)))
174 `(("python-setuptools-scm" ,python-setuptools-scm)))
175 (home-page "https://github.com/jaraco/pytest-checkdocs")
176 (synopsis "Check the README when running tests")
178 "This package provides a pytest plugin that checks the long description
179 of the project to ensure it renders properly.")
180 (license license:expat)))
182 (define-public python-pytest-flake8
184 (name "python-pytest-flake8")
189 (uri (pypi-uri "pytest-flake8" version))
192 "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd"))))
193 (build-system python-build-system)
195 `(("python-flake8" ,python-flake8)))
197 `(("python-pytest" ,python-pytest)))
198 (home-page "https://github.com/tholo/pytest-flake8")
199 (synopsis "Pytest plugin to check FLAKE8 requirements")
201 "This package provides a pytest plugin for efficiently checking PEP8
203 (license license:bsd-3)))
205 (define-public python-pytest-isort
207 (name "python-pytest-isort")
212 (uri (pypi-uri "pytest-isort" version))
214 (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
215 (build-system python-build-system)
218 (modify-phases %standard-phases
222 (string-append (getcwd) ":"
223 (getenv "PYTHONPATH")))
224 (invoke "pytest"))))))
226 `(("python-isort" ,python-isort)
227 ("python-pytest" ,python-pytest)))
228 (home-page "https://github.com/moccu/pytest-isort/")
229 (synopsis "Pytest plugin to check import ordering using isort")
231 "This package provides a pytest plugin to check import ordering using
233 (license license:bsd-3)))
235 (define-public python-pytest-shutil
237 (name "python-pytest-shutil")
242 (uri (pypi-uri "pytest-shutil" version))
245 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq"))))
246 (build-system python-build-system)
249 (modify-phases %standard-phases
250 (add-after 'unpack 'patch-tests
253 (substitute* "tests/integration/test_cmdline_integration.py"
254 (("dirname = '/bin'")
255 "dirname = '/tmp/bin'")
256 (("bindir = os.path.realpath\\('/bin'\\)")
257 "bindir = os.path.realpath('/tmp/bin')"))
260 `(("python-contextlib2" ,python-contextlib2)
261 ("python-execnet" ,python-execnet)
262 ("python-pathpy" ,python-pathpy)
263 ("python-termcolor" ,python-termcolor)))
265 `(("python-mock" ,python-mock)
266 ("python-pytest" ,python-pytest)
267 ("python-setuptools-git" ,python-setuptools-git)))
268 (home-page "https://github.com/manahl/pytest-plugins")
269 (synopsis "Assorted shell and environment tools for py.test")
271 "This package provides assorted shell and environment tools for the
272 py.test testing framework.")
273 (license license:expat)))
275 (define-public python-pytest-fixture-config
277 (name "python-pytest-fixture-config")
282 (uri (pypi-uri "pytest-fixture-config" version))
285 "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1"))))
286 (build-system python-build-system)
288 `(("python-pytest" ,python-pytest)
289 ("python-setuptools-git" ,python-setuptools-git)))
290 (home-page "https://github.com/manahl/pytest-plugins")
291 (synopsis "Fixture configuration utils for py.test")
293 "This package provides fixture configuration utilities for the py.test
295 (license license:expat)))
297 (define-public python-pytest-virtualenv
299 (name "python-pytest-virtualenv")
304 (uri (pypi-uri "pytest-virtualenv" version))
307 "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
308 (build-system python-build-system)
311 (modify-phases %standard-phases
312 ;; Reference the virtualenv executable directly, to avoid the need
313 ;; for PYTHONPATH, which gets cleared when instantiating a new
314 ;; virtualenv with pytest-virtualenv.
315 (add-after 'unpack 'patch-virtualenv-executable
316 (lambda* (#:key inputs #:allow-other-keys)
317 (let* ((virtualenv (assoc-ref inputs "python-virtualenv"))
318 (virtualenv-bin (string-append virtualenv
320 (substitute* "pytest_virtualenv.py"
321 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
322 (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
326 `(("python-pytest-shutil" ,python-pytest-shutil)
327 ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
329 `(("python-virtualenv" ,python-virtualenv)))
331 `(("python-mock" ,python-mock)
332 ("python-pytest" ,python-pytest)
333 ("python-setuptools-git" ,python-setuptools-git)))
334 (home-page "https://github.com/manahl/pytest-plugins")
335 (synopsis "Virtualenv fixture for py.test")
336 (description "This package provides a virtualenv fixture for the py.test
338 (license license:expat)))
340 (define-public python-codacy-coverage
342 (name "python-codacy-coverage")
347 (uri (pypi-uri "codacy-coverage" version))
350 "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr"))))
351 (build-system python-build-system)
353 `(#:tests? #f)); no tests
355 `(("python-check-manifest" ,python-check-manifest)))
356 (home-page "https://github.com/codacy/python-codacy-coverage")
357 (synopsis "Codacy coverage reporter for Python")
358 (description "This package analyses Python test suites and reports how much
359 of the code is covered by them. This tool is part of the Codacy suite for
360 analysing code quality.")
361 (license license:expat)))
363 (define-public python-httmock
365 (name "python-httmock")
370 (uri (pypi-uri "httmock" version))
373 "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0"))))
374 (build-system python-build-system)
376 `(#:tests? #f)); no tests
378 `(("python-requests" ,python-requests)))
379 (home-page "https://github.com/patrys/httmock")
380 (synopsis "Mocking library for requests.")
381 (description "This package provides a library for replying fake data to
382 Python software under test, when they make an HTTP query.")
383 (license license:asl2.0)))