Merge remote-tracking 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 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 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages python-check)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages check)
26 #:use-module (gnu packages python-web)
27 #:use-module (gnu packages python-xyz)
28 #:use-module (gnu packages web)
29 #:use-module (guix utils)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix build-system python))
34
35 (define-public python-coveralls
36 (package
37 (name "python-coveralls")
38 (version "1.6.0")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (pypi-uri "coveralls" version))
43 (sha256
44 (base32
45 "1dswhd2q2412wrldi97hdwlsymj9pm79v7pvjx53z5wh2d33w8bg"))))
46 (build-system python-build-system)
47 (propagated-inputs
48 `(("python-coverage" ,python-coverage)
49 ("python-docopt" ,python-docopt)
50 ("python-pyyaml" ,python-pyyaml)
51 ("python-requests" ,python-requests)
52 ("python-sh" ,python-sh)
53 ("python-urllib3" ,python-urllib3)))
54 (native-inputs
55 `(("python-mock" ,python-mock)
56 ("python-pytest" ,python-pytest)))
57 (home-page "https://github.com/coveralls-clients/coveralls-python")
58 (synopsis "Show coverage stats online via coveralls.io")
59 (description
60 "Coveralls.io is a service for publishing code coverage statistics online.
61 This package provides seamless integration with coverage.py (and thus pytest,
62 nosetests, etc...) in Python projects.")
63 (license license:expat)))
64
65 (define-public python-vcrpy
66 (package
67 (name "python-vcrpy")
68 (version "2.0.1")
69 (source
70 (origin
71 (method url-fetch)
72 (uri (pypi-uri "vcrpy" version))
73 (sha256
74 (base32
75 "0kws7l3hci1dvjv01nxw3805q9v2mwldw58bgl8s90wqism69gjp"))))
76 (build-system python-build-system)
77 (arguments `(#:tests? #f)) ; tests require more packages for python-pytest-httpbin
78 (propagated-inputs
79 `(("python-pyyaml" ,python-pyyaml)
80 ("python-six" ,python-six)
81 ("python-wrapt" ,python-wrapt)
82 ("python-yarl" ,python-yarl)))
83 (native-inputs
84 `(("python-mock" ,python-mock)
85 ("python-pytest" ,python-pytest)
86 ("python-pytest-httpbin" ,python-pytest-httpbin)))
87 (home-page "https://github.com/kevin1024/vcrpy")
88 (synopsis "Automatically mock your HTTP interactions")
89 (description
90 "VCR.py simplifies and speeds up tests that make HTTP requests. The first
91 time you run code that is inside a VCR.py context manager or decorated function,
92 VCR.py records all HTTP interactions that take place through the libraries it
93 supports and serializes and writes them to a flat file (in yaml format by
94 default). This flat file is called a cassette. When the relevant piece of code
95 is executed again, VCR.py will read the serialized requests and responses from
96 the aforementioned cassette file, and intercept any HTTP requests that it
97 recognizes from the original test run and return the responses that corresponded
98 to those requests. This means that the requests will not actually result in
99 HTTP traffic, which confers several benefits including:
100 @enumerate
101 @item The ability to work offline
102 @item Completely deterministic tests
103 @item Increased test execution speed
104 @end enumerate
105 If the server you are testing against ever changes its API, all you need to do
106 is delete your existing cassette files, and run your tests again. VCR.py will
107 detect the absence of a cassette file and once again record all HTTP
108 interactions, which will update them to correspond to the new API.")
109 (license license:expat)))
110
111 (define-public python-pytest-checkdocs
112 (package
113 (name "python-pytest-checkdocs")
114 (version "1.2.2")
115 (source
116 (origin
117 (method url-fetch)
118 (uri (pypi-uri "pytest-checkdocs" version))
119 (sha256
120 (base32 "0j6j1gvj6x451y3qsx4xbaq9p1w9gg3mwk7n0w80cy8vdyjkngb0"))))
121 (build-system python-build-system)
122 (propagated-inputs
123 `(("python-importlib-metadata" ,python-importlib-metadata)
124 ("python-more-itertools" ,python-more-itertools)))
125 (native-inputs
126 `(("python-setuptools-scm" ,python-setuptools-scm)))
127 (home-page "https://github.com/jaraco/pytest-checkdocs")
128 (synopsis "Check the README when running tests")
129 (description
130 "This package provides a pytest plugin that checks the long description
131 of the project to ensure it renders properly.")
132 (license license:expat)))
133
134 (define-public python-pytest-flake8
135 (package
136 (name "python-pytest-flake8")
137 (version "1.0.4")
138 (source
139 (origin
140 (method url-fetch)
141 (uri (pypi-uri "pytest-flake8" version))
142 (sha256
143 (base32
144 "1h30gd21fjsafqxwclf25sdh89vrdz7rsh4lzw11aiw7ww9mq8jd"))))
145 (build-system python-build-system)
146 (propagated-inputs
147 `(("python-flake8" ,python-flake8)))
148 (native-inputs
149 `(("python-pytest" ,python-pytest)))
150 (home-page "https://github.com/tholo/pytest-flake8")
151 (synopsis "Pytest plugin to check FLAKE8 requirements")
152 (description
153 "This package provides a pytest plugin for efficiently checking PEP8
154 compliance.")
155 (license license:bsd-3)))
156
157 (define-public python-pytest-isort
158 (package
159 (name "python-pytest-isort")
160 (version "0.3.1")
161 (source
162 (origin
163 (method url-fetch)
164 (uri (pypi-uri "pytest-isort" version))
165 (sha256
166 (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
167 (build-system python-build-system)
168 (arguments
169 `(#:phases
170 (modify-phases %standard-phases
171 (replace 'check
172 (lambda _
173 (setenv "PYTHONPATH"
174 (string-append (getcwd) ":"
175 (getenv "PYTHONPATH")))
176 (invoke "pytest"))))))
177 (propagated-inputs
178 `(("python-isort" ,python-isort)
179 ("python-pytest" ,python-pytest)))
180 (home-page "https://github.com/moccu/pytest-isort/")
181 (synopsis "Pytest plugin to check import ordering using isort")
182 (description
183 "This package provides a pytest plugin to check import ordering using
184 isort.")
185 (license license:bsd-3)))
186
187 (define-public python-pytest-shutil
188 (package
189 (name "python-pytest-shutil")
190 (version "1.7.0")
191 (source
192 (origin
193 (method url-fetch)
194 (uri (pypi-uri "pytest-shutil" version))
195 (sha256
196 (base32
197 "0q8j0ayzmnvlraml6i977ybdq4xi096djhf30n2m1rvnvrhm45nq"))))
198 (build-system python-build-system)
199 (arguments
200 `(#:phases
201 (modify-phases %standard-phases
202 (add-after 'unpack 'patch-tests
203 (lambda _
204 (mkdir "/tmp/bin")
205 (substitute* "tests/integration/test_cmdline_integration.py"
206 (("dirname = '/bin'")
207 "dirname = '/tmp/bin'")
208 (("bindir = os.path.realpath\\('/bin'\\)")
209 "bindir = os.path.realpath('/tmp/bin')"))
210 #t)))))
211 (propagated-inputs
212 `(("python-contextlib2" ,python-contextlib2)
213 ("python-execnet" ,python-execnet)
214 ("python-pathpy" ,python-pathpy)
215 ("python-termcolor" ,python-termcolor)))
216 (native-inputs
217 `(("python-mock" ,python-mock)
218 ("python-pytest" ,python-pytest)
219 ("python-setuptools-git" ,python-setuptools-git)))
220 (home-page "https://github.com/manahl/pytest-plugins")
221 (synopsis "Assorted shell and environment tools for py.test")
222 (description
223 "This package provides assorted shell and environment tools for the
224 py.test testing framework.")
225 (license license:expat)))
226
227 (define-public python-pytest-fixture-config
228 (package
229 (name "python-pytest-fixture-config")
230 (version "1.7.0")
231 (source
232 (origin
233 (method url-fetch)
234 (uri (pypi-uri "pytest-fixture-config" version))
235 (sha256
236 (base32
237 "13i1qpz22w3x4dmw8vih5jdnbqfqvl7jiqs0dg764s0zf8bp98a1"))))
238 (build-system python-build-system)
239 (native-inputs
240 `(("python-pytest" ,python-pytest)
241 ("python-setuptools-git" ,python-setuptools-git)))
242 (home-page "https://github.com/manahl/pytest-plugins")
243 (synopsis "Fixture configuration utils for py.test")
244 (description
245 "This package provides fixture configuration utilities for the py.test
246 testing framework.")
247 (license license:expat)))
248
249 (define-public python-pytest-virtualenv
250 (package
251 (name "python-pytest-virtualenv")
252 (version "1.7.0")
253 (source
254 (origin
255 (method url-fetch)
256 (uri (pypi-uri "pytest-virtualenv" version))
257 (sha256
258 (base32
259 "03w2zz3crblj1p6i8nq17946hbn3zqp9z7cfnifw47hi4a4fww12"))))
260 (build-system python-build-system)
261 (arguments
262 `(#:phases
263 (modify-phases %standard-phases
264 ;; Reference the virtualenv executable directly, to avoid the need
265 ;; for PYTHONPATH, which gets cleared when instantiating a new
266 ;; virtualenv with pytest-virtualenv.
267 (add-after 'unpack 'patch-virtualenv-executable
268 (lambda* (#:key inputs #:allow-other-keys)
269 (let* ((virtualenv (assoc-ref inputs "python-virtualenv"))
270 (virtualenv-bin (string-append virtualenv
271 "/bin/virtualenv")))
272 (substitute* "pytest_virtualenv.py"
273 (("^DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE.*$")
274 (format #f "DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = '~a'"
275 virtualenv-bin)))
276 #t))))))
277 (propagated-inputs
278 `(("python-pytest-shutil" ,python-pytest-shutil)
279 ("python-pytest-fixture-config" ,python-pytest-fixture-config)))
280 (inputs
281 `(("python-virtualenv" ,python-virtualenv)))
282 (native-inputs
283 `(("python-mock" ,python-mock)
284 ("python-pytest" ,python-pytest)
285 ("python-setuptools-git" ,python-setuptools-git)))
286 (home-page "https://github.com/manahl/pytest-plugins")
287 (synopsis "Virtualenv fixture for py.test")
288 (description "This package provides a virtualenv fixture for the py.test
289 framework.")
290 (license license:expat)))