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>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages python-check)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages check)
27 #:use-module (gnu packages python-web)
28 #:use-module (gnu packages python-xyz)
29 #:use-module (gnu packages web)
30 #:use-module (guix utils)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix git-download)
34 #:use-module (guix download)
35 #:use-module (guix build-system python))
37 (define-public python-coveralls
39 (name "python-coveralls")
44 (uri (pypi-uri "coveralls" version))
47 "1dswhd2q2412wrldi97hdwlsymj9pm79v7pvjx53z5wh2d33w8bg"))))
48 (build-system python-build-system)
50 `(("python-coverage" ,python-coverage)
51 ("python-docopt" ,python-docopt)
52 ("python-pyyaml" ,python-pyyaml)
53 ("python-requests" ,python-requests)
54 ("python-sh" ,python-sh)
55 ("python-urllib3" ,python-urllib3)))
57 `(("python-mock" ,python-mock)
58 ("python-pytest" ,python-pytest)))
59 (home-page "https://github.com/coveralls-clients/coveralls-python")
60 (synopsis "Show coverage stats online via coveralls.io")
62 "Coveralls.io is a service for publishing code coverage statistics online.
63 This package provides seamless integration with coverage.py (and thus pytest,
64 nosetests, etc...) in Python projects.")
65 (license license:expat)))
67 (define-public python-vcrpy
74 (uri (pypi-uri "vcrpy" version))
77 "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp"))))
78 (build-system python-build-system)
79 (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin
81 `(("python-pyyaml" ,python-pyyaml)
82 ("python-six" ,python-six)
83 ("python-wrapt" ,python-wrapt)
84 ("python-yarl" ,python-yarl)))
86 `(("python-mock" ,python-mock)
87 ("python-pytest" ,python-pytest)
88 ("python-pytest-httpbin" ,python-pytest-httpbin)))
89 (home-page "https://github.com/kevin1024/vcrpy")
90 (synopsis "Automatically mock your HTTP interactions")
92 "VCR.py simplifies and speeds up tests that make HTTP requests. The first
93 time you run code that is inside a VCR.py context manager or decorated function,
94 VCR.py records all HTTP interactions that take place through the libraries it
95 supports and serializes and writes them to a flat file (in yaml format by
96 default). This flat file is called a cassette. When the relevant piece of code
97 is executed again, VCR.py will read the serialized requests and responses from
98 the aforementioned cassette file, and intercept any HTTP requests that it
99 recognizes from the original test run and return the responses that corresponded
100 to those requests. This means that the requests will not actually result in
101 HTTP traffic, which confers several benefits including:
103 @item The ability to work offline
104 @item Completely deterministic tests
105 @item Increased test execution speed
107 If the server you are testing against ever changes its API, all you need to do
108 is delete your existing cassette files, and run your tests again. VCR.py will
109 detect the absence of a cassette file and once again record all HTTP
110 interactions, which will update them to correspond to the new API.")
111 (license license:expat)))
113 (define-public python-pytest-vcr
115 (name "python-pytest-vcr")
121 (url "https://github.com/ktosiek/pytest-vcr")
123 (file-name (git-file-name name version))
126 "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i"))))
127 (build-system python-build-system)
130 (modify-phases %standard-phases
132 (lambda* (#:key inputs outputs #:allow-other-keys)
133 (add-installed-pythonpath inputs outputs)
134 (invoke "pytest" "tests/"))))))
136 `(("python-pytest" ,python-pytest)
137 ("python-vcrpy" ,python-vcrpy)))
138 (home-page "https://github.com/ktosiek/pytest-vcr")
139 (synopsis "Plugin for managing VCR.py cassettes")
141 "Plugin for managing VCR.py cassettes.")
142 (license license:expat)))
144 (define-public python-pytest-checkdocs
146 (name "python-pytest-checkdocs")
151 (uri (pypi-uri "pytest-checkdocs" version))
153 (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0"))))
154 (build-system python-build-system)
156 `(("python-docutils" ,python-docutils)
157 ("python-importlib-metadata" ,python-importlib-metadata)
158 ("python-more-itertools" ,python-more-itertools)))
160 `(("python-setuptools-scm" ,python-setuptools-scm)))
161 (home-page "https://github.com/jaraco/pytest-checkdocs")
162 (synopsis "Check the README when running tests")
164 "This package provides a pytest plugin that checks the long description
165 of the project to ensure it renders properly.")
166 (license license:expat)))
168 (define-public python-pytest-flake8
170 (name "python-pytest-flake8")
175 (uri (pypi-uri "pytest-flake8" version))
178 "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd"))))
179 (build-system python-build-system)
181 `(("python-flake8" ,python-flake8)))
183 `(("python-pytest" ,python-pytest)))
184 (home-page "https://github.com/tholo/pytest-flake8")
185 (synopsis "Pytest plugin to check FLAKE8 requirements")
187 "This package provides a pytest plugin for efficiently checking PEP8
189 (license license:bsd-3)))
191 (define-public python-pytest-isort
193 (name "python-pytest-isort")
198 (uri (pypi-uri "pytest-isort" version))
200 (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
201 (build-system python-build-system)
204 (modify-phases %standard-phases
208 (string-append (getcwd) ":"
209 (getenv "PYTHONPATH")))
210 (invoke "pytest"))))))
212 `(("python-isort" ,python-isort)
213 ("python-pytest" ,python-pytest)))
214 (home-page "https://github.com/moccu/pytest-isort/")
215 (synopsis "Pytest plugin to check import ordering using isort")
217 "This package provides a pytest plugin to check import ordering using
219 (license license:bsd-3)))
221 (define-public python-pytest-shutil
223 (name "python-pytest-shutil")
228 (uri (pypi-uri "pytest-shutil" version))
231 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq"))))
232 (build-system python-build-system)
235 (modify-phases %standard-phases
236 (add-after 'unpack 'patch-tests
239 (substitute* "tests/integration/test_cmdline_integration.py"
240 (("dirname = '/bin'")
241 "dirname = '/tmp/bin'")
242 (("bindir = os.path.realpath\\('/bin'\\)")
243 "bindir = os.path.realpath('/tmp/bin')"))
246 `(("python-contextlib2" ,python-contextlib2)
247 ("python-execnet" ,python-execnet)
248 ("python-pathpy" ,python-pathpy)
249 ("python-termcolor" ,python-termcolor)))
251 `(("python-mock" ,python-mock)
252 ("python-pytest" ,python-pytest)
253 ("python-setuptools-git" ,python-setuptools-git)))
254 (home-page "https://github.com/manahl/pytest-plugins")
255 (synopsis "Assorted shell and environment tools for py.test")
257 "This package provides assorted shell and environment tools for the
258 py.test testing framework.")
259 (license license:expat)))
261 (define-public python-pytest-fixture-config
263 (name "python-pytest-fixture-config")
268 (uri (pypi-uri "pytest-fixture-config" version))
271 "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1"))))
272 (build-system python-build-system)
274 `(("python-pytest" ,python-pytest)
275 ("python-setuptools-git" ,python-setuptools-git)))
276 (home-page "https://github.com/manahl/pytest-plugins")
277 (synopsis "Fixture configuration utils for py.test")
279 "This package provides fixture configuration utilities for the py.test
281 (license license:expat)))
283 (define-public python-pytest-virtualenv
285 (name "python-pytest-virtualenv")
290 (uri (pypi-uri "pytest-virtualenv" version))
293 "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
294 (build-system python-build-system)
297 (modify-phases %standard-phases
298 ;; Reference the virtualenv executable directly, to avoid the need
299 ;; for PYTHONPATH, which gets cleared when instantiating a new
300 ;; virtualenv with pytest-virtualenv.
301 (add-after 'unpack 'patch-virtualenv-executable
302 (lambda* (#:key inputs #:allow-other-keys)
303 (let* ((virtualenv (assoc-ref inputs "python-virtualenv"))
304 (virtualenv-bin (string-append virtualenv
306 (substitute* "pytest_virtualenv.py"
307 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
308 (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
312 `(("python-pytest-shutil" ,python-pytest-shutil)
313 ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
315 `(("python-virtualenv" ,python-virtualenv)))
317 `(("python-mock" ,python-mock)
318 ("python-pytest" ,python-pytest)
319 ("python-setuptools-git" ,python-setuptools-git)))
320 (home-page "https://github.com/manahl/pytest-plugins")
321 (synopsis "Virtualenv fixture for py.test")
322 (description "This package provides a virtualenv fixture for the py.test
324 (license license:expat)))
326 (define-public python-codacy-coverage
328 (name "python-codacy-coverage")
333 (uri (pypi-uri "codacy-coverage" version))
336 "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr"))))
337 (build-system python-build-system)
339 `(#:tests? #f)); no tests
341 `(("python-check-manifest" ,python-check-manifest)))
342 (home-page "https://github.com/codacy/python-codacy-coverage")
343 (synopsis "Codacy coverage reporter for Python")
344 (description "This package analyses Python test suites and reports how much
345 of the code is covered by them. This tool is part of the Codacy suite for
346 analysing code quality.")
347 (license license:expat)))
349 (define-public python-httmock
351 (name "python-httmock")
356 (uri (pypi-uri "httmock" version))
359 "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0"))))
360 (build-system python-build-system)
362 `(#:tests? #f)); no tests
364 `(("python-requests" ,python-requests)))
365 (home-page "https://github.com/patrys/httmock")
366 (synopsis "Mocking library for requests.")
367 (description "This package provides a library for replying fake data to
368 Python software under test, when they make an HTTP query.")
369 (license license:asl2.0)))