Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / python-check.scm
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 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
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.
15 ;;;
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.
20 ;;;
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/>.
23
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))
36
37 (define-public python-coveralls
38 (package
39 (name "python-coveralls")
40 (version "1.6.0")
41 (source
42 (origin
43 (method url-fetch)
44 (uri (pypi-uri "coveralls" version))
45 (sha256
46 (base32
47 "1dswhd2q2412wrldi97hdwlsymj9pm79v7pvjx53z5wh2d33w8bg"))))
48 (build-system python-build-system)
49 (propagated-inputs
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)))
56 (native-inputs
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")
61 (description
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)))
66
67 (define-public python-vcrpy
68 (package
69 (name "python-vcrpy")
70 (version "2.0.1")
71 (source
72 (origin
73 (method url-fetch)
74 (uri (pypi-uri "vcrpy" version))
75 (sha256
76 (base32
77 "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp"))))
78 (build-system python-build-system)
79 (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin
80 (propagated-inputs
81 `(("python-pyyaml" ,python-pyyaml)
82 ("python-six" ,python-six)
83 ("python-wrapt" ,python-wrapt)
84 ("python-yarl" ,python-yarl)))
85 (native-inputs
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")
91 (description
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:
102 @enumerate
103 @item The ability to work offline
104 @item Completely deterministic tests
105 @item Increased test execution speed
106 @end enumerate
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)))
112
113 (define-public python-pytest-vcr
114 (package
115 (name "python-pytest-vcr")
116 (version "1.0.2")
117 (source
118 (origin
119 (method git-fetch)
120 (uri (git-reference
121 (url "https://github.com/ktosiek/pytest-vcr")
122 (commit version)))
123 (file-name (git-file-name name version))
124 (sha256
125 (base32
126 "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i"))))
127 (build-system python-build-system)
128 (arguments
129 `(#:phases
130 (modify-phases %standard-phases
131 (replace 'check
132 (lambda* (#:key inputs outputs #:allow-other-keys)
133 (add-installed-pythonpath inputs outputs)
134 (invoke "pytest" "tests/"))))))
135 (propagated-inputs
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")
140 (description
141 "Plugin for managing VCR.py cassettes.")
142 (license license:expat)))
143
144 (define-public python-pytest-checkdocs
145 (package
146 (name "python-pytest-checkdocs")
147 (version "1.2.2")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (pypi-uri "pytest-checkdocs" version))
152 (sha256
153 (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0"))))
154 (build-system python-build-system)
155 (propagated-inputs
156 `(("python-docutils" ,python-docutils)
157 ("python-importlib-metadata" ,python-importlib-metadata)
158 ("python-more-itertools" ,python-more-itertools)))
159 (native-inputs
160 `(("python-setuptools-scm" ,python-setuptools-scm)))
161 (home-page "https://github.com/jaraco/pytest-checkdocs")
162 (synopsis "Check the README when running tests")
163 (description
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)))
167
168 (define-public python-pytest-flake8
169 (package
170 (name "python-pytest-flake8")
171 (version "1.0.4")
172 (source
173 (origin
174 (method url-fetch)
175 (uri (pypi-uri "pytest-flake8" version))
176 (sha256
177 (base32
178 "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd"))))
179 (build-system python-build-system)
180 (propagated-inputs
181 `(("python-flake8" ,python-flake8)))
182 (native-inputs
183 `(("python-pytest" ,python-pytest)))
184 (home-page "https://github.com/tholo/pytest-flake8")
185 (synopsis "Pytest plugin to check FLAKE8 requirements")
186 (description
187 "This package provides a pytest plugin for efficiently checking PEP8
188 compliance.")
189 (license license:bsd-3)))
190
191 (define-public python-pytest-isort
192 (package
193 (name "python-pytest-isort")
194 (version "0.3.1")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (pypi-uri "pytest-isort" version))
199 (sha256
200 (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
201 (build-system python-build-system)
202 (arguments
203 `(#:phases
204 (modify-phases %standard-phases
205 (replace 'check
206 (lambda _
207 (setenv "PYTHONPATH"
208 (string-append (getcwd) ":"
209 (getenv "PYTHONPATH")))
210 (invoke "pytest"))))))
211 (propagated-inputs
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")
216 (description
217 "This package provides a pytest plugin to check import ordering using
218 isort.")
219 (license license:bsd-3)))
220
221 (define-public python-pytest-shutil
222 (package
223 (name "python-pytest-shutil")
224 (version "1.7.0")
225 (source
226 (origin
227 (method url-fetch)
228 (uri (pypi-uri "pytest-shutil" version))
229 (sha256
230 (base32
231 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq"))))
232 (build-system python-build-system)
233 (arguments
234 `(#:phases
235 (modify-phases %standard-phases
236 (add-after 'unpack 'patch-tests
237 (lambda _
238 (mkdir "/tmp/bin")
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')"))
244 #t)))))
245 (propagated-inputs
246 `(("python-contextlib2" ,python-contextlib2)
247 ("python-execnet" ,python-execnet)
248 ("python-pathpy" ,python-pathpy)
249 ("python-termcolor" ,python-termcolor)))
250 (native-inputs
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")
256 (description
257 "This package provides assorted shell and environment tools for the
258 py.test testing framework.")
259 (license license:expat)))
260
261 (define-public python-pytest-fixture-config
262 (package
263 (name "python-pytest-fixture-config")
264 (version "1.7.0")
265 (source
266 (origin
267 (method url-fetch)
268 (uri (pypi-uri "pytest-fixture-config" version))
269 (sha256
270 (base32
271 "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1"))))
272 (build-system python-build-system)
273 (native-inputs
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")
278 (description
279 "This package provides fixture configuration utilities for the py.test
280 testing framework.")
281 (license license:expat)))
282
283 (define-public python-pytest-virtualenv
284 (package
285 (name "python-pytest-virtualenv")
286 (version "1.7.0")
287 (source
288 (origin
289 (method url-fetch)
290 (uri (pypi-uri "pytest-virtualenv" version))
291 (sha256
292 (base32
293 "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
294 (build-system python-build-system)
295 (arguments
296 `(#:phases
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
305 "/bin/virtualenv")))
306 (substitute* "pytest_virtualenv.py"
307 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
308 (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
309 virtualenv-bin)))
310 #t))))))
311 (propagated-inputs
312 `(("python-pytest-shutil" ,python-pytest-shutil)
313 ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
314 (inputs
315 `(("python-virtualenv" ,python-virtualenv)))
316 (native-inputs
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
323 framework.")
324 (license license:expat)))
325
326 (define-public python-codacy-coverage
327 (package
328 (name "python-codacy-coverage")
329 (version "1.3.11")
330 (source
331 (origin
332 (method url-fetch)
333 (uri (pypi-uri "codacy-coverage" version))
334 (sha256
335 (base32
336 "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr"))))
337 (build-system python-build-system)
338 (arguments
339 `(#:tests? #f)); no tests
340 (propagated-inputs
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)))
348
349 (define-public python-httmock
350 (package
351 (name "python-httmock")
352 (version "1.3.0")
353 (source
354 (origin
355 (method url-fetch)
356 (uri (pypi-uri "httmock" version))
357 (sha256
358 (base32
359 "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0"))))
360 (build-system python-build-system)
361 (arguments
362 `(#:tests? #f)); no tests
363 (propagated-inputs
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)))