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> |
e253b94d RW |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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. | |
21 | ;;; | |
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/>. | |
24 | ||
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) | |
9569db37 | 30 | #:use-module (gnu packages web) |
e253b94d RW |
31 | #:use-module (guix utils) |
32 | #:use-module ((guix licenses) #:prefix license:) | |
33 | #:use-module (guix packages) | |
6e003bd4 | 34 | #:use-module (guix git-download) |
e253b94d RW |
35 | #:use-module (guix download) |
36 | #:use-module (guix build-system python)) | |
37 | ||
38 | (define-public python-coveralls | |
39 | (package | |
40 | (name "python-coveralls") | |
5d9d9383 MB |
41 | (version "1.11.1") |
42 | (home-page "https://github.com/coveralls-clients/coveralls-python") | |
e253b94d RW |
43 | (source |
44 | (origin | |
5d9d9383 MB |
45 | ;; The PyPI release lacks tests, so we pull from git instead. |
46 | (method git-fetch) | |
47 | (uri (git-reference (url home-page) (commit version))) | |
48 | (file-name (git-file-name name version)) | |
e253b94d RW |
49 | (sha256 |
50 | (base32 | |
5d9d9383 | 51 | "1zr1lqdjcfwj6wcx2449mzzjq8bbhwnqcm5vdif5s8hlz35bjxkp")))) |
e253b94d | 52 | (build-system python-build-system) |
5d9d9383 MB |
53 | (arguments |
54 | '(#:phases (modify-phases %standard-phases | |
55 | (add-before 'check 'disable-git-test | |
56 | (lambda _ | |
57 | ;; Remove test that requires 'git' and the full checkout. | |
58 | (delete-file "tests/git_test.py") | |
59 | #t)) | |
60 | (replace 'check | |
61 | (lambda* (#:key tests? #:allow-other-keys) | |
62 | (if tests? | |
63 | (invoke "pytest" "-vv") | |
64 | (format #t "test suite not run~%")) | |
65 | #t))))) | |
e253b94d RW |
66 | (propagated-inputs |
67 | `(("python-coverage" ,python-coverage) | |
68 | ("python-docopt" ,python-docopt) | |
69 | ("python-pyyaml" ,python-pyyaml) | |
5d9d9383 | 70 | ("python-requests" ,python-requests))) |
e253b94d RW |
71 | (native-inputs |
72 | `(("python-mock" ,python-mock) | |
73 | ("python-pytest" ,python-pytest))) | |
e253b94d RW |
74 | (synopsis "Show coverage stats online via coveralls.io") |
75 | (description | |
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))) | |
9569db37 EF |
80 | |
81 | (define-public python-vcrpy | |
82 | (package | |
83 | (name "python-vcrpy") | |
84 | (version "2.0.1") | |
85 | (source | |
86 | (origin | |
87 | (method url-fetch) | |
88 | (uri (pypi-uri "vcrpy" version)) | |
89 | (sha256 | |
90 | (base32 | |
91 | "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp")))) | |
92 | (build-system python-build-system) | |
93 | (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin | |
94 | (propagated-inputs | |
95 | `(("python-pyyaml" ,python-pyyaml) | |
96 | ("python-six" ,python-six) | |
97 | ("python-wrapt" ,python-wrapt) | |
98 | ("python-yarl" ,python-yarl))) | |
99 | (native-inputs | |
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") | |
105 | (description | |
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: | |
116 | @enumerate | |
117 | @item The ability to work offline | |
118 | @item Completely deterministic tests | |
119 | @item Increased test execution speed | |
120 | @end enumerate | |
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))) | |
85bf6798 | 126 | |
6e003bd4 EF |
127 | (define-public python-pytest-vcr |
128 | (package | |
129 | (name "python-pytest-vcr") | |
130 | (version "1.0.2") | |
131 | (source | |
132 | (origin | |
133 | (method git-fetch) | |
134 | (uri (git-reference | |
135 | (url "https://github.com/ktosiek/pytest-vcr") | |
136 | (commit version))) | |
137 | (file-name (git-file-name name version)) | |
138 | (sha256 | |
139 | (base32 | |
140 | "1i6fin91mklvbi8jzfiswvwf1m91f43smpj36a17xrzk4gisfs6i")))) | |
141 | (build-system python-build-system) | |
142 | (arguments | |
143 | `(#:phases | |
144 | (modify-phases %standard-phases | |
145 | (replace 'check | |
146 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
147 | (add-installed-pythonpath inputs outputs) | |
148 | (invoke "pytest" "tests/")))))) | |
149 | (propagated-inputs | |
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") | |
154 | (description | |
155 | "Plugin for managing VCR.py cassettes.") | |
156 | (license license:expat))) | |
157 | ||
85bf6798 RW |
158 | (define-public python-pytest-checkdocs |
159 | (package | |
160 | (name "python-pytest-checkdocs") | |
4d755996 | 161 | (version "1.2.2") |
85bf6798 RW |
162 | (source |
163 | (origin | |
164 | (method url-fetch) | |
165 | (uri (pypi-uri "pytest-checkdocs" version)) | |
166 | (sha256 | |
4d755996 | 167 | (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0")))) |
85bf6798 RW |
168 | (build-system python-build-system) |
169 | (propagated-inputs | |
59fa08d6 MB |
170 | `(("python-docutils" ,python-docutils) |
171 | ("python-importlib-metadata" ,python-importlib-metadata) | |
4d755996 | 172 | ("python-more-itertools" ,python-more-itertools))) |
85bf6798 RW |
173 | (native-inputs |
174 | `(("python-setuptools-scm" ,python-setuptools-scm))) | |
175 | (home-page "https://github.com/jaraco/pytest-checkdocs") | |
176 | (synopsis "Check the README when running tests") | |
177 | (description | |
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))) | |
3b89476b RW |
181 | |
182 | (define-public python-pytest-flake8 | |
183 | (package | |
184 | (name "python-pytest-flake8") | |
185 | (version "1.0.4") | |
186 | (source | |
187 | (origin | |
188 | (method url-fetch) | |
189 | (uri (pypi-uri "pytest-flake8" version)) | |
190 | (sha256 | |
191 | (base32 | |
192 | "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd")))) | |
193 | (build-system python-build-system) | |
194 | (propagated-inputs | |
195 | `(("python-flake8" ,python-flake8))) | |
196 | (native-inputs | |
197 | `(("python-pytest" ,python-pytest))) | |
198 | (home-page "https://github.com/tholo/pytest-flake8") | |
199 | (synopsis "Pytest plugin to check FLAKE8 requirements") | |
200 | (description | |
201 | "This package provides a pytest plugin for efficiently checking PEP8 | |
202 | compliance.") | |
203 | (license license:bsd-3))) | |
21e2c559 | 204 | |
c1ff9072 HG |
205 | (define-public python-pytest-isort |
206 | (package | |
207 | (name "python-pytest-isort") | |
208 | (version "0.3.1") | |
209 | (source | |
210 | (origin | |
211 | (method url-fetch) | |
212 | (uri (pypi-uri "pytest-isort" version)) | |
213 | (sha256 | |
214 | (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb")))) | |
215 | (build-system python-build-system) | |
216 | (arguments | |
217 | `(#:phases | |
218 | (modify-phases %standard-phases | |
219 | (replace 'check | |
220 | (lambda _ | |
221 | (setenv "PYTHONPATH" | |
222 | (string-append (getcwd) ":" | |
223 | (getenv "PYTHONPATH"))) | |
224 | (invoke "pytest")))))) | |
225 | (propagated-inputs | |
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") | |
230 | (description | |
231 | "This package provides a pytest plugin to check import ordering using | |
232 | isort.") | |
233 | (license license:bsd-3))) | |
234 | ||
21e2c559 RW |
235 | (define-public python-pytest-shutil |
236 | (package | |
237 | (name "python-pytest-shutil") | |
238 | (version "1.7.0") | |
239 | (source | |
240 | (origin | |
241 | (method url-fetch) | |
242 | (uri (pypi-uri "pytest-shutil" version)) | |
243 | (sha256 | |
244 | (base32 | |
245 | "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq")))) | |
246 | (build-system python-build-system) | |
247 | (arguments | |
248 | `(#:phases | |
249 | (modify-phases %standard-phases | |
250 | (add-after 'unpack 'patch-tests | |
251 | (lambda _ | |
252 | (mkdir "/tmp/bin") | |
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')")) | |
258 | #t))))) | |
259 | (propagated-inputs | |
260 | `(("python-contextlib2" ,python-contextlib2) | |
261 | ("python-execnet" ,python-execnet) | |
262 | ("python-pathpy" ,python-pathpy) | |
263 | ("python-termcolor" ,python-termcolor))) | |
264 | (native-inputs | |
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") | |
270 | (description | |
271 | "This package provides assorted shell and environment tools for the | |
272 | py.test testing framework.") | |
273 | (license license:expat))) | |
7d5ffecb RW |
274 | |
275 | (define-public python-pytest-fixture-config | |
276 | (package | |
277 | (name "python-pytest-fixture-config") | |
278 | (version "1.7.0") | |
279 | (source | |
280 | (origin | |
281 | (method url-fetch) | |
282 | (uri (pypi-uri "pytest-fixture-config" version)) | |
283 | (sha256 | |
284 | (base32 | |
285 | "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1")))) | |
286 | (build-system python-build-system) | |
287 | (native-inputs | |
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") | |
292 | (description | |
293 | "This package provides fixture configuration utilities for the py.test | |
294 | testing framework.") | |
295 | (license license:expat))) | |
05b3dcbe RW |
296 | |
297 | (define-public python-pytest-virtualenv | |
298 | (package | |
299 | (name "python-pytest-virtualenv") | |
300 | (version "1.7.0") | |
301 | (source | |
302 | (origin | |
303 | (method url-fetch) | |
304 | (uri (pypi-uri "pytest-virtualenv" version)) | |
305 | (sha256 | |
306 | (base32 | |
307 | "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12")))) | |
308 | (build-system python-build-system) | |
e2fb29b7 MC |
309 | (arguments |
310 | `(#:phases | |
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 | |
319 | "/bin/virtualenv"))) | |
320 | (substitute* "pytest_virtualenv.py" | |
321 | (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$") | |
322 | (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'" | |
323 | virtualenv-bin))) | |
324 | #t)))))) | |
05b3dcbe | 325 | (propagated-inputs |
e2fb29b7 | 326 | `(("python-pytest-shutil" ,python-pytest-shutil) |
05b3dcbe | 327 | ("python-pytest-fixture-config" ,python-pytest-fixture-config))) |
e2fb29b7 MC |
328 | (inputs |
329 | `(("python-virtualenv" ,python-virtualenv))) | |
05b3dcbe RW |
330 | (native-inputs |
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 | |
337 | framework.") | |
338 | (license license:expat))) | |
9532c0bb JL |
339 | |
340 | (define-public python-codacy-coverage | |
341 | (package | |
342 | (name "python-codacy-coverage") | |
343 | (version "1.3.11") | |
344 | (source | |
345 | (origin | |
346 | (method url-fetch) | |
347 | (uri (pypi-uri "codacy-coverage" version)) | |
348 | (sha256 | |
349 | (base32 | |
350 | "1g0c0w56xdkmqb8slacyw5qhzrkp814ng3ddh2lkiij58y9m2imr")))) | |
351 | (build-system python-build-system) | |
352 | (arguments | |
353 | `(#:tests? #f)); no tests | |
354 | (propagated-inputs | |
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))) | |
63f76ab2 JL |
362 | |
363 | (define-public python-httmock | |
364 | (package | |
365 | (name "python-httmock") | |
366 | (version "1.3.0") | |
367 | (source | |
368 | (origin | |
369 | (method url-fetch) | |
370 | (uri (pypi-uri "httmock" version)) | |
371 | (sha256 | |
372 | (base32 | |
373 | "1zj1fcm0n6f0wr9mr0hmlqz9430fnr5cdwd5jkcvq9j44bnsrfz0")))) | |
374 | (build-system python-build-system) | |
375 | (arguments | |
376 | `(#:tests? #f)); no tests | |
377 | (propagated-inputs | |
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))) |