Commit | Line | Data |
---|---|---|
e253b94d RW |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> | |
5bcb2f0f | 3 | ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
6e003bd4 | 4 | ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il> |
e2fb29b7 | 5 | ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
c1ff9072 | 6 | ;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com> |
9532c0bb | 7 | ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> |
5d9d9383 | 8 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
d79c917f | 9 | ;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com> |
e253b94d RW |
10 | ;;; |
11 | ;;; This file is part of GNU Guix. | |
12 | ;;; | |
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. | |
17 | ;;; | |
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. | |
22 | ;;; | |
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/>. | |
25 | ||
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) | |
9569db37 | 31 | #:use-module (gnu packages web) |
e253b94d RW |
32 | #:use-module (guix utils) |
33 | #:use-module ((guix licenses) #:prefix license:) | |
34 | #:use-module (guix packages) | |
6e003bd4 | 35 | #:use-module (guix git-download) |
e253b94d RW |
36 | #:use-module (guix download) |
37 | #:use-module (guix build-system python)) | |
38 | ||
39 | (define-public python-coveralls | |
40 | (package | |
41 | (name "python-coveralls") | |
5d9d9383 MB |
42 | (version "1.11.1") |
43 | (home-page "https://github.com/coveralls-clients/coveralls-python") | |
e253b94d RW |
44 | (source |
45 | (origin | |
5d9d9383 MB |
46 | ;; The PyPI release lacks tests, so we pull from git instead. |
47 | (method git-fetch) | |
48 | (uri (git-reference (url home-page) (commit version))) | |
49 | (file-name (git-file-name name version)) | |
e253b94d RW |
50 | (sha256 |
51 | (base32 | |
5d9d9383 | 52 | "1zr1lqdjcfwj6wcx2449mzzjq8bbhwnqcm5vdif5s8hlz35bjxkp")))) |
e253b94d | 53 | (build-system python-build-system) |
5d9d9383 MB |
54 | (arguments |
55 | '(#:phases (modify-phases %standard-phases | |
56 | (add-before 'check 'disable-git-test | |
57 | (lambda _ | |
58 | ;; Remove test that requires 'git' and the full checkout. | |
59 | (delete-file "tests/git_test.py") | |
60 | #t)) | |
61 | (replace 'check | |
62 | (lambda* (#:key tests? #:allow-other-keys) | |
63 | (if tests? | |
64 | (invoke "pytest" "-vv") | |
65 | (format #t "test suite not run~%")) | |
66 | #t))))) | |
e253b94d RW |
67 | (propagated-inputs |
68 | `(("python-coverage" ,python-coverage) | |
69 | ("python-docopt" ,python-docopt) | |
70 | ("python-pyyaml" ,python-pyyaml) | |
5d9d9383 | 71 | ("python-requests" ,python-requests))) |
e253b94d RW |
72 | (native-inputs |
73 | `(("python-mock" ,python-mock) | |
74 | ("python-pytest" ,python-pytest))) | |
e253b94d RW |
75 | (synopsis "Show coverage stats online via coveralls.io") |
76 | (description | |
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))) | |
9569db37 EF |
81 | |
82 | (define-public python-vcrpy | |
83 | (package | |
84 | (name "python-vcrpy") | |
85 | (version "2.0.1") | |
86 | (source | |
87 | (origin | |
88 | (method url-fetch) | |
89 | (uri (pypi-uri "vcrpy" version)) | |
90 | (sha256 | |
91 | (base32 | |
92 | "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp")))) | |
93 | (build-system python-build-system) | |
94 | (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin | |
95 | (propagated-inputs | |
96 | `(("python-pyyaml" ,python-pyyaml) | |
97 | ("python-six" ,python-six) | |
98 | ("python-wrapt" ,python-wrapt) | |
99 | ("python-yarl" ,python-yarl))) | |
100 | (native-inputs | |
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") | |
106 | (description | |
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: | |
117 | @enumerate | |
118 | @item The ability to work offline | |
119 | @item Completely deterministic tests | |
120 | @item Increased test execution speed | |
121 | @end enumerate | |
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))) | |
85bf6798 | 127 | |
6e003bd4 EF |
128 | (define-public python-pytest-vcr |
129 | (package | |
130 | (name "python-pytest-vcr") | |
131 | (version "1.0.2") | |
132 | (source | |
133 | (origin | |
134 | (method git-fetch) | |
135 | (uri (git-reference | |
136 | (url "https://github.com/ktosiek/pytest-vcr") | |
137 | (commit version))) | |
138 | (file-name (git-file-name name version)) | |
139 | (sha256 | |
140 | (base32 | |
141 | "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i")))) | |
142 | (build-system python-build-system) | |
143 | (arguments | |
144 | `(#:phases | |
145 | (modify-phases %standard-phases | |
146 | (replace 'check | |
147 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
148 | (add-installed-pythonpath inputs outputs) | |
149 | (invoke "pytest" "tests/")))))) | |
150 | (propagated-inputs | |
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") | |
155 | (description | |
156 | "Plugin for managing VCR.py cassettes.") | |
157 | (license license:expat))) | |
158 | ||
85bf6798 RW |
159 | (define-public python-pytest-checkdocs |
160 | (package | |
161 | (name "python-pytest-checkdocs") | |
4d755996 | 162 | (version "1.2.2") |
85bf6798 RW |
163 | (source |
164 | (origin | |
165 | (method url-fetch) | |
166 | (uri (pypi-uri "pytest-checkdocs" version)) | |
167 | (sha256 | |
4d755996 | 168 | (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0")))) |
85bf6798 RW |
169 | (build-system python-build-system) |
170 | (propagated-inputs | |
59fa08d6 MB |
171 | `(("python-docutils" ,python-docutils) |
172 | ("python-importlib-metadata" ,python-importlib-metadata) | |
4d755996 | 173 | ("python-more-itertools" ,python-more-itertools))) |
85bf6798 RW |
174 | (native-inputs |
175 | `(("python-setuptools-scm" ,python-setuptools-scm))) | |
176 | (home-page "https://github.com/jaraco/pytest-checkdocs") | |
177 | (synopsis "Check the README when running tests") | |
178 | (description | |
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))) | |
3b89476b RW |
182 | |
183 | (define-public python-pytest-flake8 | |
184 | (package | |
185 | (name "python-pytest-flake8") | |
186 | (version "1.0.4") | |
187 | (source | |
188 | (origin | |
189 | (method url-fetch) | |
190 | (uri (pypi-uri "pytest-flake8" version)) | |
191 | (sha256 | |
192 | (base32 | |
193 | "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd")))) | |
194 | (build-system python-build-system) | |
195 | (propagated-inputs | |
196 | `(("python-flake8" ,python-flake8))) | |
197 | (native-inputs | |
198 | `(("python-pytest" ,python-pytest))) | |
199 | (home-page "https://github.com/tholo/pytest-flake8") | |
200 | (synopsis "Pytest plugin to check FLAKE8 requirements") | |
201 | (description | |
202 | "This package provides a pytest plugin for efficiently checking PEP8 | |
203 | compliance.") | |
204 | (license license:bsd-3))) | |
21e2c559 | 205 | |
c1ff9072 HG |
206 | (define-public python-pytest-isort |
207 | (package | |
208 | (name "python-pytest-isort") | |
209 | (version "0.3.1") | |
210 | (source | |
211 | (origin | |
212 | (method url-fetch) | |
213 | (uri (pypi-uri "pytest-isort" version)) | |
214 | (sha256 | |
215 | (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb")))) | |
216 | (build-system python-build-system) | |
217 | (arguments | |
218 | `(#:phases | |
219 | (modify-phases %standard-phases | |
220 | (replace 'check | |
221 | (lambda _ | |
222 | (setenv "PYTHONPATH" | |
223 | (string-append (getcwd) ":" | |
224 | (getenv "PYTHONPATH"))) | |
225 | (invoke "pytest")))))) | |
226 | (propagated-inputs | |
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") | |
231 | (description | |
232 | "This package provides a pytest plugin to check import ordering using | |
233 | isort.") | |
234 | (license license:bsd-3))) | |
235 | ||
21e2c559 RW |
236 | (define-public python-pytest-shutil |
237 | (package | |
238 | (name "python-pytest-shutil") | |
239 | (version "1.7.0") | |
240 | (source | |
241 | (origin | |
242 | (method url-fetch) | |
243 | (uri (pypi-uri "pytest-shutil" version)) | |
244 | (sha256 | |
245 | (base32 | |
246 | "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq")))) | |
247 | (build-system python-build-system) | |
248 | (arguments | |
249 | `(#:phases | |
250 | (modify-phases %standard-phases | |
251 | (add-after 'unpack 'patch-tests | |
252 | (lambda _ | |
253 | (mkdir "/tmp/bin") | |
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')")) | |
259 | #t))))) | |
260 | (propagated-inputs | |
261 | `(("python-contextlib2" ,python-contextlib2) | |
262 | ("python-execnet" ,python-execnet) | |
263 | ("python-pathpy" ,python-pathpy) | |
264 | ("python-termcolor" ,python-termcolor))) | |
265 | (native-inputs | |
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") | |
271 | (description | |
272 | "This package provides assorted shell and environment tools for the | |
273 | py.test testing framework.") | |
274 | (license license:expat))) | |
7d5ffecb RW |
275 | |
276 | (define-public python-pytest-fixture-config | |
277 | (package | |
278 | (name "python-pytest-fixture-config") | |
279 | (version "1.7.0") | |
280 | (source | |
281 | (origin | |
282 | (method url-fetch) | |
283 | (uri (pypi-uri "pytest-fixture-config" version)) | |
284 | (sha256 | |
285 | (base32 | |
286 | "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1")))) | |
287 | (build-system python-build-system) | |
288 | (native-inputs | |
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") | |
293 | (description | |
294 | "This package provides fixture configuration utilities for the py.test | |
295 | testing framework.") | |
296 | (license license:expat))) | |
05b3dcbe RW |
297 | |
298 | (define-public python-pytest-virtualenv | |
299 | (package | |
300 | (name "python-pytest-virtualenv") | |
301 | (version "1.7.0") | |
302 | (source | |
303 | (origin | |
304 | (method url-fetch) | |
305 | (uri (pypi-uri "pytest-virtualenv" version)) | |
306 | (sha256 | |
307 | (base32 | |
308 | "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12")))) | |
309 | (build-system python-build-system) | |
e2fb29b7 MC |
310 | (arguments |
311 | `(#:phases | |
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 | |
320 | "/bin/virtualenv"))) | |
321 | (substitute* "pytest_virtualenv.py" | |
322 | (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$") | |
323 | (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'" | |
324 | virtualenv-bin))) | |
325 | #t)))))) | |
05b3dcbe | 326 | (propagated-inputs |
e2fb29b7 | 327 | `(("python-pytest-shutil" ,python-pytest-shutil) |
05b3dcbe | 328 | ("python-pytest-fixture-config" ,python-pytest-fixture-config))) |
e2fb29b7 MC |
329 | (inputs |
330 | `(("python-virtualenv" ,python-virtualenv))) | |
05b3dcbe RW |
331 | (native-inputs |
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 | |
338 | framework.") | |
339 | (license license:expat))) | |
9532c0bb | 340 | |
d79c917f EK |
341 | (define-public python-pytest-pycodestyle |
342 | (package | |
343 | (name "python-pytest-pycodestyle") | |
344 | (version "2.0.0") ;later versions require python-pytest~=5.4 | |
345 | (source | |
346 | (origin | |
347 | (method url-fetch) | |
348 | (uri (pypi-uri "pytest-pycodestyle" version)) | |
349 | (sha256 | |
350 | (base32 | |
351 | "02i5gl7pm9cwxk15sn29inz3n8flpj1r3p1l110h43f2na5w8h7z")))) | |
352 | (build-system python-build-system) | |
353 | (propagated-inputs | |
354 | `(("python-pycodestyle" ,python-pycodestyle))) | |
355 | (native-inputs | |
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))) | |
362 | ||
857c63fe EK |
363 | (define-public python-pytest-benchmark |
364 | (package | |
365 | (name "python-pytest-benchmark") | |
366 | (version "3.2.3") | |
367 | (source | |
368 | (origin | |
369 | (method url-fetch) | |
370 | (uri (pypi-uri "pytest-benchmark" version)) | |
371 | (sha256 | |
372 | (base32 | |
373 | "0a4mpb4j73dsyk47hd1prrjpfk4r458s102cn80rf253jg818hxd")))) | |
374 | (build-system python-build-system) | |
375 | (propagated-inputs | |
376 | `(("python-py-cpuinfo" ,python-py-cpuinfo))) | |
377 | (native-inputs | |
378 | `(("python-pathlib2" ,python-pathlib2) | |
379 | ("python-pytest" ,python-pytest))) | |
380 | (home-page "https://github.com/ionelmc/pytest-benchmark") | |
381 | (synopsis "Pytest fixture for benchmarking code") | |
382 | (description | |
383 | "This package provides a pytest fixture that will group the tests into | |
384 | rounds that are calibrated to the chosen timer.") | |
385 | (license license:bsd-2))) | |
386 | ||
85acb5f5 EK |
387 | (define-public python-pytest-flask |
388 | (package | |
389 | (name "python-pytest-flask") | |
390 | (version "1.0.0") | |
391 | (source | |
392 | (origin | |
393 | (method url-fetch) | |
394 | (uri (pypi-uri "pytest-flask" version)) | |
395 | (sha256 | |
396 | (base32 | |
397 | "1hln7mwgdzfi5ma0kqfsi768l7p24jhkw8l0imhifwy08nh7hmjd")))) | |
398 | (build-system python-build-system) | |
399 | (native-inputs | |
400 | `(("python-flask" ,python-flask) | |
401 | ("python-pytest" ,python-pytest) | |
402 | ("python-setuptools-scm" ,python-setuptools-scm) | |
403 | ("python-werkzeug" ,python-werkzeug))) | |
404 | (home-page "https://github.com/pytest-dev/pytest-flask") | |
405 | (synopsis "Pytest fixtures to test Flask applications") | |
406 | (description | |
407 | "This pytest plugin provides fixtures to simplify Flask app testing.") | |
408 | (license license:expat))) | |
409 | ||
9532c0bb JL |
410 | (define-public python-codacy-coverage |
411 | (package | |
412 | (name "python-codacy-coverage") | |
413 | (version "1.3.11") | |
414 | (source | |
415 | (origin | |
416 | (method url-fetch) | |
417 | (uri (pypi-uri "codacy-coverage" version)) | |
418 | (sha256 | |
419 | (base32 | |
420 | "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr")))) | |
421 | (build-system python-build-system) | |
422 | (arguments | |
423 | `(#:tests? #f)); no tests | |
424 | (propagated-inputs | |
425 | `(("python-check-manifest" ,python-check-manifest))) | |
426 | (home-page "https://github.com/codacy/python-codacy-coverage") | |
427 | (synopsis "Codacy coverage reporter for Python") | |
428 | (description "This package analyses Python test suites and reports how much | |
429 | of the code is covered by them. This tool is part of the Codacy suite for | |
430 | analysing code quality.") | |
431 | (license license:expat))) | |
63f76ab2 JL |
432 | |
433 | (define-public python-httmock | |
434 | (package | |
435 | (name "python-httmock") | |
436 | (version "1.3.0") | |
437 | (source | |
438 | (origin | |
439 | (method url-fetch) | |
440 | (uri (pypi-uri "httmock" version)) | |
441 | (sha256 | |
442 | (base32 | |
443 | "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0")))) | |
444 | (build-system python-build-system) | |
445 | (arguments | |
446 | `(#:tests? #f)); no tests | |
447 | (propagated-inputs | |
448 | `(("python-requests" ,python-requests))) | |
449 | (home-page "https://github.com/patrys/httmock") | |
450 | (synopsis "Mocking library for requests.") | |
451 | (description "This package provides a library for replying fake data to | |
452 | Python software under test, when they make an HTTP query.") | |
453 | (license license:asl2.0))) |