Merge branch 'master' into staging
[guix.git] / gnu / packages / check.scm
blob4bb608bd8fa2f73ae69ff302a4871b06dec27509
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
5 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
7 ;;; Copyright © 2015, 2017 Cyril Roelandt <tipecaml@gmail.com>
8 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
9 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
10 ;;; Copyright © 2015, 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
12 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
13 ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym+a@scratchpost.org>
14 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
15 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
16 ;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
17 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
18 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
19 ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
20 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
21 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
22 ;;; Copyright © 2017, 2018 Arun Isaac <arunisaac@systemreboot.net>
23 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
24 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
25 ;;; Copyright © 2017, 2019 Kei Kebreau <kkebreau@posteo.net>
26 ;;; Copyright © 2017 ng0 <ng0@n0.is>
27 ;;; Copyright © 2015, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
28 ;;; Copyright © 2016, 2017, 2018 Marius Bakke <mbakke@fastmail.com>
29 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
30 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
31 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
32 ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
33 ;;;
34 ;;; This file is part of GNU Guix.
35 ;;;
36 ;;; GNU Guix is free software; you can redistribute it and/or modify it
37 ;;; under the terms of the GNU General Public License as published by
38 ;;; the Free Software Foundation; either version 3 of the License, or (at
39 ;;; your option) any later version.
40 ;;;
41 ;;; GNU Guix is distributed in the hope that it will be useful, but
42 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
43 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44 ;;; GNU General Public License for more details.
45 ;;;
46 ;;; You should have received a copy of the GNU General Public License
47 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
49 (define-module (gnu packages check)
50   #:use-module (gnu packages)
51   #:use-module (gnu packages autotools)
52   #:use-module (gnu packages base)
53   #:use-module (gnu packages bash)
54   #:use-module (gnu packages compression)
55   #:use-module (gnu packages linux)
56   #:use-module (gnu packages llvm)
57   #:use-module (gnu packages glib)
58   #:use-module (gnu packages gnome)
59   #:use-module (gnu packages golang)
60   #:use-module (gnu packages gtk)
61   #:use-module (gnu packages perl)
62   #:use-module (gnu packages pkg-config)
63   #:use-module (gnu packages python)
64   #:use-module (gnu packages python-web)
65   #:use-module (gnu packages python-xyz)
66   #:use-module (gnu packages time)
67   #:use-module (guix utils)
68   #:use-module ((guix licenses) #:prefix license:)
69   #:use-module (guix packages)
70   #:use-module (guix download)
71   #:use-module (guix git-download)
72   #:use-module (guix build-system cmake)
73   #:use-module (guix build-system gnu)
74   #:use-module (guix build-system go)
75   #:use-module (guix build-system python)
76   #:use-module (guix build-system trivial))
78 (define-public check
79   (package
80     (name "check")
81     (version "0.12.0")
82     (source
83      (origin
84       (method url-fetch)
85       (uri (string-append "https://github.com/libcheck/check/releases/download/"
86                           version "/check-" version ".tar.gz"))
87       (sha256
88        (base32
89         "0d22h8xshmbpl9hba9ch3xj8vb9ybm5akpsbbh7yj07fic4h2hj6"))))
90     (build-system gnu-build-system)
91     (home-page "https://libcheck.github.io/check/")
92     (synopsis "Unit test framework for C")
93     (description
94      "Check is a unit testing framework for C.  It features a simple
95 interface for defining unit tests, putting little in the way of the
96 developer.  Tests are run in a separate address space, so Check can
97 catch both assertion failures and code errors that cause segmentation
98 faults or other signals.  The output from unit tests can be used within
99 source code editors and IDEs.")
100     (license license:lgpl2.1+)))
102 (define-public cunit
103   (package
104     (name "cunit")
105     (version "2.1-3")
106     (source
107      (origin
108        (method url-fetch)
109        (uri (string-append "mirror://sourceforge/cunit/CUnit/"
110                            version "/CUnit-" version ".tar.bz2"))
111        (sha256
112         (base32
113          "057j82da9vv4li4z5ri3227ybd18nzyq81f6gsvhifs5z0vr3cpm"))))
114     (build-system gnu-build-system)
115     (arguments '(#:phases
116                  (modify-phases %standard-phases
117                    ;; XXX: The "bootstrap" phase detects the "bootstrap"
118                    ;; script, but fails to execute it, so we bootstrap
119                    ;; manually.
120                    (replace 'bootstrap
121                      (lambda _ (invoke "autoreconf" "-vfi"))))))
122     (native-inputs
123      `(("automake" ,automake)
124        ("autoconf" ,autoconf)
125        ("libtool" ,libtool)))
126     (home-page "http://cunit.sourceforge.net/")
127     (synopsis "Automated testing framework for C")
128     (description
129      "CUnit is a lightweight system for writing, administering, and running
130 unit tests in C.  It provides C programmers with basic testing functionality
131 with a flexible variety of user interfaces.")
132     (license license:gpl2+)))
134 (define-public cppunit
135   (package
136     (name "cppunit")
137     (version "1.13.2")
138     (source (origin
139              (method url-fetch)
140               (uri (string-append "http://dev-www.libreoffice.org/src/"
141                                   name "-" version ".tar.gz"))
142              (sha256
143               (base32
144                "17s2kzmkw3kfjhpp72rfppyd7syr7bdq5s69syj2nvrlwd3d4irz"))))
145     ;; Explicitly link with libdl. This is expected to be done by packages
146     ;; relying on cppunit for their tests. However, not all of them do.
147     ;; If we added the linker flag to such packages, we would pollute all
148     ;; binaries, not only those used for testing.
149     (arguments
150      `(#:make-flags '("LDFLAGS=-ldl")))
151     (build-system gnu-build-system)
152     (home-page "https://wiki.freedesktop.org/www/Software/cppunit/")
153     (synopsis "Unit testing framework for C++")
154     (description "CppUnit is the C++ port of the famous JUnit framework for
155 unit testing.  Test output is in XML for automatic testing and GUI based for
156 supervised tests.")
157     (license license:lgpl2.1))) ; no copyright notices. LGPL2.1 is in the tarball
159 ;; Some packages require this newer version of cppunit.  However, it needs
160 ;; C++11 support, which is not enabled by default in our current GCC, and
161 ;; updating in-place would require adding CXXFLAGS to many dependent packages.
162 ;; Thus, keep as a separate variable for now.
163 ;; TODO: Remove this when our default GCC is updated to 6 or higher.
164 (define-public cppunit-1.14
165   (package
166     (inherit cppunit)
167     (version "1.14.0")
168     (source (origin
169               (method url-fetch)
170               (uri (string-append "https://dev-www.libreoffice.org/src/"
171                                   "cppunit-" version ".tar.gz"))
172               (sha256
173                (base32
174                 "1027cyfx5gsjkdkaf6c2wnjh68882grw8n672018cj3vs9lrhmix"))))))
176 ;; When dependent packages upgraded to use newer version of catch, this one should
177 ;; be removed.
178 (define-public catch-framework
179   (package
180     (name "catch")
181     (version "1.3.5")                  ;Sub-minor is the build number
182     (source (origin
183               (method git-fetch)
184               (uri (git-reference
185                     (url "https://github.com/philsquared/Catch")
186                     ;; Semi-arbitrary.
187                     (commit "ae5ee2cf63d6d67bd1369b512d2a7b60b571c907")))
188               (file-name (string-append name "-" version))
189               (sha256
190                (base32
191                 "1yfb3lxv929szqy1nw9xw3d45wzkppziqshkjxvrb1fdmf46x564"))))
192     (build-system trivial-build-system)
193     (arguments
194      `(#:modules ((guix build utils))
195        #:builder (begin
196                    (use-modules (guix build utils))
197                    (let* ((source (assoc-ref %build-inputs "source"))
198                           (output (assoc-ref %outputs "out"))
199                           (incdir (string-append output "/include"))
200                           (docdir (string-append output "/share/doc/catch-"
201                                                  ,version)))
202                      (for-each mkdir-p (list incdir docdir))
203                      (install-file (string-append source
204                                                   "/single_include/catch.hpp")
205                                    incdir)
206                      (copy-recursively (string-append source "/docs")
207                                        docdir)
208                      #t))))
209     (home-page "http://catch-lib.net/")
210     (synopsis "Automated test framework for C++ and Objective-C")
211     (description
212      "Catch stands for C++ Automated Test Cases in Headers and is a
213 multi-paradigm automated test framework for C++ and Objective-C.")
214     (license license:boost1.0)))
216 (define-public catch-framework2
217   (package
218     (name "catch2")
219     (version "1.12.2")
220     (home-page "https://github.com/catchorg/Catch2")
221     (source (origin
222               (method git-fetch)
223               (uri (git-reference
224                      (url "https://github.com/catchorg/Catch2")
225                      (commit (string-append "v" version))))
226               (file-name (git-file-name name version))
227               (sha256
228                (base32
229                 "1gdp5wm8khn02g2miz381llw3191k7309qj8s3jd6sasj01rhf23"))))
230     (build-system cmake-build-system)
231     (synopsis "Automated test framework for C++ and Objective-C")
232     (description "Catch2 stands for C++ Automated Test Cases in Headers and is
233 a multi-paradigm automated test framework for C++ and Objective-C.")
234     (license license:boost1.0)))
236 (define-public cmdtest
237   (package
238     (name "cmdtest")
239     (version "0.32")
240     (source (origin
241               (method url-fetch)
242               (uri (string-append "http://git.liw.fi/cmdtest/snapshot/"
243                                   name "-" version ".tar.gz"))
244               (sha256
245                (base32
246                 "1jmfiyrrqmpvwdb273bkb8hjaf4rwx9njblx29pmr7giyahskwi5"))))
247     (build-system python-build-system)
248     (arguments
249      `(#:python ,python-2
250        #:phases
251        (modify-phases %standard-phases
252          ;; check phase needs to be run before the build phase. If not, the
253          ;; coverage test runner looks for tests for the built source files,
254          ;; and fails.
255          (delete 'check)
256          (add-before 'build 'check
257            (lambda _
258              (substitute* "yarn"
259                (("/bin/sh") (which "sh")))
260              ;; yarn uses python2-ttystatus to print messages.
261              ;; python2-ttystatus requires /dev/tty which is not present in
262              ;; the build environment. Hence assuming-failure test fails.
263              (delete-file "yarn.tests/assuming-failure.script")
264              (delete-file "yarn.tests/assuming-failure.stdout")
265              (invoke "python" "setup.py" "check"))))))
266     (native-inputs
267      `(("python2-coverage-test-runner" ,python2-coverage-test-runner)))
268     (propagated-inputs
269      `(("python2-cliapp" ,python2-cliapp)
270        ("python2-markdown" ,python2-markdown)
271        ("python2-ttystatus" ,python2-ttystatus)))
272     (home-page "https://liw.fi/cmdtest/")
273     (synopsis "Black box Unix program tester")
274     (description
275      "@code{cmdtest} black box tests Unix command line tools.  Roughly, it is
276 given a command line and input files, and the expected output, and it verifies
277 that the command line produces the expected output.  If not, it reports a
278 problem, and shows the differences.")
279     (license license:gpl3+)))
281 (define-public cmocka
282   (package
283     (name "cmocka")
284     (version "1.1.3")
285     (source (origin
286               (method url-fetch)
287               (uri (string-append "https://cmocka.org/files/"
288                                   (version-major+minor version) "/cmocka-"
289                                   version ".tar.xz"))
290               (sha256
291                (base32
292                 "1bxzzafjlwzgldcb07hjnlnqvh88wh21r2kw7z8f704w5bvvrsj3"))))
293     (build-system cmake-build-system)
294     (arguments
295      `(#:tests? #f))                    ; no test target
296     (home-page "https://cmocka.org/")
297     (synopsis "Unit testing framework for C")
298     (description "Cmocka is a unit testing framework for C with support for
299 mock objects.  It only requires the standard C library, and works with
300 different compilers.  Cmocka supports several different message output formats
301 like Test Anything Protocol, Subunit, xUnit XML or the original cmockery output
302 format.")
303     (license license:asl2.0)))
305 (define-public cppcheck
306   (package
307     (name "cppcheck")
308     (version "1.87")
309     (source (origin
310       (method git-fetch)
311       (uri (git-reference
312              (url "https://github.com/danmar/cppcheck")
313              (commit version)))
314       (file-name (git-file-name name version))
315       (sha256
316        (base32 "1xiy54rz99nzbpwj35jiyssd2nc6k5k0lw5ml6nh2qnmbfkl8swl"))))
317     (build-system cmake-build-system)
318     (arguments
319      '(#:configure-flags '("-DBUILD_TESTS=ON")))
320     (home-page "http://cppcheck.sourceforge.net")
321     (synopsis "Static C/C++ code analyzer")
322     (description "Cppcheck is a static code analyzer for C and C++.  Unlike
323 C/C++ compilers and many other analysis tools it does not detect syntax errors
324 in the code.  Cppcheck primarily detects the types of bugs that the compilers
325 normally do not detect.  The goal is to detect only real errors in the code
326 (i.e. have zero false positives).")
327     (license license:gpl3+)))
329 (define-public cxxtest
330   (package
331     (name "cxxtest")
332     (version "4.4")
333     (source (origin
334               (method url-fetch)
335               (uri (string-append "mirror://sourceforge/cxxtest/cxxtest/"
336                                   version "/cxxtest-" version ".tar.gz"))
337               (sha256
338                (base32
339                 "1n7pbj4z9ivx005hqvivj9ddhq8awynzg6jishfbypf6j7ply58w"))))
340     (build-system python-build-system)
341     (arguments
342      '(#:phases
343        (modify-phases %standard-phases
344          (add-after 'unpack 'chdir-to-source
345            (lambda _
346              (chdir "python")
347              #t))
348          (add-after 'install 'install-headers
349            (lambda* (#:key outputs #:allow-other-keys)
350              (let* ((out (assoc-ref outputs "out"))
351                     (include-dir (string-append out "/include/cxxtest")))
352                (for-each (lambda (header-file)
353                            (install-file header-file include-dir))
354                          (find-files "../cxxtest"))
355                #t)))
356          (add-after 'install 'install-doc
357            (lambda* (#:key outputs #:allow-other-keys)
358              (let* ((out (assoc-ref outputs "out"))
359                     (doc-dir (string-append out "/share/doc/cxxtest")))
360                (install-file "../README" doc-dir)
361                (install-file "../doc/guide.txt" doc-dir)
362                (copy-recursively "../sample" (string-append doc-dir "/sample"))
363                #t))))))
364     (propagated-inputs
365      `(("python-ply" ,python-ply)))
366     (home-page "https://cxxtest.com/")
367     (synopsis "Unit testing framework for C++")
368     (description "CxxTest is a unit testing framework for C++ that is similar
369 in spirit to JUnit, CppUnit, and xUnit.  CxxTest does not require precompiling
370 a CxxTest testing library, it employs no advanced features of C++ (e.g. RTTI)
371 and it supports a very flexible form of test discovery.")
372     (license license:lgpl3+)))
374 (define-public go-gopkg.in-check.v1
375   (let ((commit "788fd78401277ebd861206a03c884797c6ec5541")
376         (revision "1"))
377     (package
378       (name "go-gopkg.in-check.v1")
379       (version (git-version "0.0.0" revision commit))
380       (source (origin
381                 (method git-fetch)
382                 (uri (git-reference
383                       (url "https://github.com/go-check/check.git")
384                       (commit commit)))
385                 (file-name (git-file-name name version))
386                 (sha256
387                  (base32
388                   "0v3bim0j375z81zrpr5qv42knqs0y2qv2vkjiqi5axvb78slki1a"))))
389       (build-system go-build-system)
390       (arguments
391        '(#:import-path "gopkg.in/check.v1"))
392       (propagated-inputs
393        `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty)))
394       (synopsis "Rich testing extension for Go's testing package")
395       (description
396        "@code{check} is a rich testing extension for Go's testing package.")
397       (home-page "https://github.com/go-check/check")
398       (license license:bsd-2))))
400 (define-public go-github.com-smartystreets-gunit
401   (package
402     (name "go-github.com-smartystreets-gunit")
403     (version "1.0.0")
404     (source (origin
405               (method git-fetch)
406               (uri (git-reference
407                     (url "https://github.com/smartystreets/gunit")
408                     (commit version)))
409               (file-name (git-file-name name version))
410               (sha256
411                (base32
412                 "00m4zg0kdj49mnpmf9klb44ba71p966xsk6zknrzqgfc8119f35z"))))
413     (build-system go-build-system)
414     (arguments
415      '(;; TODO: This package depends on go-github.com-smartystreets-assertions
416        ;; for running the tests, but go-github.com-smartystreets-assertions
417        ;; depends on this package, so break this loop by not running the tests
418        ;; for this package.
419        #:tests? #f
420        #:import-path "github.com/smartystreets/gunit"))
421     (synopsis "Testing tool for Go, in the style of xUnit")
422     (description
423      "@code{gunit} allows the test author to use a struct as the scope for a
424 group of related test cases, in the style of xUnit fixtures.  This makes
425 extraction of setup/teardown behavior (as well as invoking the system under
426 test) much simpler.")
427     (home-page "https://github.com/smartystreets/gunit")
428     (license license:expat)))
430 (define-public go-github.com-smartystreets-assertions
431   (package
432     (name "go-github.com-smartystreets-assertions")
433     (version "1.8.1")
434     (source (origin
435               (method git-fetch)
436               (uri (git-reference
437                     (url "https://github.com/smartystreets/assertions")
438                     (commit version)))
439               (file-name (git-file-name name version))
440               (sha256
441                (base32
442                 "1j0adgbykl55rf2945g0n5bmqdsnjcqlx5dcmpfh4chki43hiwg9"))))
443     (build-system go-build-system)
444     (arguments
445      '(#:import-path "github.com/smartystreets/assertions"))
446     (native-inputs
447      `(("go-github.com-smartystreets-gunit" ,go-github.com-smartystreets-gunit)))
448     (synopsis "Assertions for testing with Go")
449     (description
450      "The @code{assertions} package provides convenient assertion functions
451 for writing tests in Go.")
452     (home-page "https://github.com/smartystreets/assertions")
453     (license license:expat)))
455 (define-public go-github.com-smartystreets-goconvey
456   (package
457     (name "go-github.com-smartystreets-goconvey")
458     (version "1.6.3")
459     (source (origin
460               (method git-fetch)
461               (uri (git-reference
462                     (url "https://github.com/smartystreets/goconvey")
463                     (commit version)))
464               (file-name (git-file-name name version))
465               (sha256
466                (base32
467                 "1ph18rkl3ns3fgin5i4j54w5a69grrmf3apcsmnpdn1wlrbs3dxh"))))
468     (build-system go-build-system)
469     (arguments
470      '(#:import-path "github.com/smartystreets/goconvey"))
471     (propagated-inputs
472      `(("go-github.com-jtolds-gls" ,go-github.com-jtolds-gls)
473        ("go-github.com-smartystreets-assertions" ,go-github.com-smartystreets-assertions)))
474     (synopsis "Go testing tool with both a web and terminal user interface")
475     (description
476      "GoConvey is a testing tool for Go. It integrates with go test, can show
477 test coverage and has a web user interface that will refresh automatically.")
478     (home-page "https://github.com/smartystreets/goconvey")
479     (license license:expat)))
481 ;; XXX When updating, check whether ZNC's GOOGLETEST-SOURCES can be
482 ;; switched back to simply using (PACKAGE-SOURCE ...).
483 (define-public googletest
484   (package
485     (name "googletest")
486     (version "1.8.0")
487     (source
488      (origin
489        (method git-fetch)
490        (uri (git-reference
491               (url "https://github.com/google/googletest.git")
492               (commit (string-append "release-" version))))
493        (file-name (git-file-name name version))
494        (sha256
495         (base32
496          "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
497     (build-system cmake-build-system)
498     (arguments
499      `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
500     (native-inputs
501      `(("python-2" ,python-2)))
502     (home-page "https://github.com/google/googletest/")
503     (synopsis "Test discovery and XUnit test framework")
504     (description "Google Test features an XUnit test framework, automated test
505 discovery, death tests, assertions, parameterized tests and XML test report
506 generation.")
507     (license license:bsd-3)))
509 (define-public cpputest
510   (package
511     (name "cpputest")
512     (version "3.8")
513     (source
514      (origin
515        (method url-fetch)
516        (uri (string-append "https://github.com/cpputest/cpputest/releases/download/v"
517                            version "/cpputest-" version ".tar.gz"))
518        (sha256
519         (base32
520          "0mk48xd3klyqi7wf3f4wn4zqxxzmvrhhl32r25jzrixzl72wq7f8"))))
521     (build-system gnu-build-system)
522     (native-inputs
523      `(("googletest" ,googletest)))
524     (home-page "https://cpputest.github.io/")
525     (synopsis "Unit testing and mocking framework for C/C++")
526     (description
527      "CppUTest is a C/C++ based unit xUnit test framework.  It is written in
528 C++ but is used in C and C++ projects and frequently used in embedded systems
529 but it works for any C/C++ project.")
530     (license license:bsd-3)))
532 (define-public python-parameterized
533   (package
534     (name "python-parameterized")
535     (version "0.6.1")
536     (source
537      (origin
538        (method url-fetch)
539        (uri (pypi-uri "parameterized" version))
540        (sha256
541         (base32
542          "1qj1939shm48d9ql6fm1nrdy4p7sdyj8clz1szh5swwpf1qqxxfa"))))
543     (build-system python-build-system)
544     (arguments '(#:tests? #f)) ; there are no tests
545     (home-page "https://github.com/wolever/parameterized")
546     (synopsis "Parameterized testing with any Python test framework")
547     (description
548      "Parameterized is a Python library that aims to fix parameterized testing
549 for every Python test framework.  It supports nose, py.test, and unittest.")
550     (license license:bsd-2)))
552 (define-public python2-parameterized
553   (package-with-python2 python-parameterized))
555 (define-public python-minimock
556   (package
557     (name "python-minimock")
558     (version "1.2.8")
559     (source
560      (origin
561        (method url-fetch)
562        (uri (pypi-uri "MiniMock" version))
563        (sha256
564         (base32
565          "0k2sxb1ibnyg05iblz7zhbv825f1zk9906rab7883iqgvzmdzpsz"))))
566     (build-system python-build-system)
567     (home-page "https://pypi.org/project/MiniMock")
568     (synopsis "Simple Python library for using mock objects")
569     (description "MiniMock is a simple library for building mock objects with
570 doctest.")
571     (license license:expat)))
573 (define-public python2-minimock
574   (package-with-python2 python-minimock))
576 (define-public python-mock
577   (package
578     (name "python-mock")
579     (version "2.0.0")
580     (source
581      (origin
582        (method url-fetch)
583        (uri (pypi-uri "mock" version))
584        (sha256
585         (base32
586          "1flbpksir5sqrvq2z0dp8sl4bzbadg21sj4d42w3klpdfvgvcn5i"))))
587     (propagated-inputs
588      `(("python-pbr" ,python-pbr-minimal)
589        ("python-six" ,python-six)))
590     (build-system python-build-system)
591     (native-inputs
592      `(("python-unittest2" ,python-unittest2)))
593     (arguments
594      `(#:phases
595        (modify-phases %standard-phases
596          (replace 'check
597            (lambda _
598              (zero? (system* "unit2")))))))
599     (home-page "https://github.com/testing-cabal/mock")
600     (synopsis "Python mocking and patching library for testing")
601     (description
602      "Mock is a library for testing in Python.  It allows you to replace parts
603 of your system under test with mock objects and make assertions about how they
604 have been used.")
605     (properties `((python2-variant . ,(delay python2-mock))))
606     (license license:expat)))
608 (define-public python2-mock
609   (let ((base (package-with-python2
610                (strip-python2-variant python-mock))))
611     (package (inherit base)
612       (propagated-inputs
613        `(("python2-functools32" ,python2-functools32)
614          ("python2-funcsigs" ,python2-funcsigs)
615          ,@(package-propagated-inputs base))))))
617 (define-public python-nose
618   (package
619     (name "python-nose")
620     (version "1.3.7")
621     (source
622       (origin
623         (method url-fetch)
624         (uri (pypi-uri "nose" version))
625         (sha256
626           (base32
627             "164a43k7k2wsqqk1s6vavcdamvss4mz0vd6pwzv2h9n8rgwzxgzi"))))
628     (build-system python-build-system)
629     (arguments
630      '(#:tests? #f)) ; FIXME: test suite fails
631     (home-page "http://readthedocs.org/docs/nose/")
632     (synopsis "Python testing library")
633     (description
634      "Nose extends the unittest library to make testing easier.")
635     (license license:lgpl2.0+)))
637 (define-public python2-nose
638   (package-with-python2 python-nose))
640 (define-public python-nose2
641   (package
642     (name "python-nose2")
643     (version "0.6.5")
644       (source
645         (origin
646           (method url-fetch)
647           (uri (pypi-uri "nose2" version))
648           (sha256
649            (base32
650             "1x4zjq1zlyrh8b9ba0cmafd3w94pxhid408kibyjd3s6h1lap6s7"))))
651     (build-system python-build-system)
652     (arguments `(#:tests? #f)) ; 'module' object has no attribute 'collector'
653     (propagated-inputs
654      `(("python-cov-core" ,python-cov-core)
655        ("python-pytest-cov" ,python-pytest-cov)
656        ("python-six" ,python-six)))
657     (home-page "https://github.com/nose-devs/nose2")
658     (synopsis "Next generation of nicer testing for Python")
659     (description
660      "Nose2 is the next generation of nicer testing for Python, based on the
661 plugins branch of unittest2.  Nose2 aims to improve on nose by providing a
662 better plugin api, being easier for users to configure, and simplifying internal
663 interfaces and processes.")
664     (license license:bsd-2)))
666 (define-public python2-nose2
667   (package-with-python2 python-nose2))
669 (define-public python-unittest2
670   (package
671     (name "python-unittest2")
672     (version "1.1.0")
673     (source
674      (origin
675        (method url-fetch)
676        (uri (pypi-uri "unittest2" version))
677        (patches
678         (search-patches "python-unittest2-python3-compat.patch"
679                         "python-unittest2-remove-argparse.patch"))
680        (sha256
681         (base32
682          "0y855kmx7a8rnf81d3lh5lyxai1908xjp0laf4glwa4c8472m212"))))
683     (build-system python-build-system)
684     (arguments
685      '(#:phases
686        (modify-phases %standard-phases
687          (replace 'check
688            (lambda _
689              (zero? (system* "python" "-m" "unittest2" "discover" "--verbose")))))))
690     (propagated-inputs
691      `(("python-six" ,python-six)
692        ("python-traceback2" ,python-traceback2)))
693     (home-page "http://pypi.python.org/pypi/unittest2")
694     (synopsis "Python unit testing library")
695     (description
696      "Unittest2 is a replacement for the unittest module in the Python
697 standard library.")
698     (license license:psfl)))
700 (define-public python2-unittest2
701   (package-with-python2 python-unittest2))
703 (define-public python-pytest
704   (package
705     (name "python-pytest")
706     (version "3.8.0")
707     (source
708      (origin
709        (method url-fetch)
710        (uri (pypi-uri "pytest" version))
711        (sha256
712         (base32
713          "17grcfvd6ggvvqmprwv5y8g319nayam70hr43ssjwj40ws27z858"))))
714     (build-system python-build-system)
715     (arguments
716      `(#:phases
717        (modify-phases %standard-phases
718          (add-before 'check 'disable-invalid-tests
719            (lambda _
720              ;; Some tests involves the /usr directory, and fails.
721              (substitute* "testing/test_argcomplete.py"
722                (("def test_remove_dir_prefix\\(self\\):")
723                 "@pytest.mark.xfail\n    def test_remove_dir_prefix(self):"))
724              (substitute* "testing/test_argcomplete.py"
725                (("def test_remove_dir_prefix" line)
726                 (string-append "@pytest.mark.skip"
727                                "(reason=\"Assumes that /usr exists.\")\n    "
728                                line)))
729              #t))
730          (replace 'check (lambda _ (invoke "pytest" "-vv"))))))
731     (propagated-inputs
732      `(("python-atomicwrites" ,python-atomicwrites)
733        ("python-attrs" ,python-attrs-bootstrap)
734        ("python-more-itertools" ,python-more-itertools)
735        ("python-pluggy" ,python-pluggy)
736        ("python-py" ,python-py)
737        ("python-six" ,python-six-bootstrap)))
738     (native-inputs
739      `(;; Tests need the "regular" bash since 'bash-final' lacks `compgen`.
740        ("bash" ,bash)
741        ("python-hypothesis" ,python-hypothesis)
742        ("python-nose" ,python-nose)
743        ("python-mock" ,python-mock)
744        ("python-pytest" ,python-pytest-bootstrap)
745        ("python-setuptools-scm" ,python-setuptools-scm)))
746     (home-page "https://docs.pytest.org/en/latest/")
747     (synopsis "Python testing library")
748     (description
749      "Pytest is a testing tool that provides auto-discovery of test modules
750 and functions, detailed info on failing assert statements, modular fixtures,
751 and many external plugins.")
752     (license license:expat)
753     (properties `((python2-variant . ,(delay python2-pytest))))))
755 (define-public python2-pytest
756   (let ((pytest (package-with-python2
757                  (strip-python2-variant python-pytest))))
758     (package
759       (inherit pytest)
760       (propagated-inputs
761        `(("python2-funcsigs" ,python2-funcsigs)
762          ("python2-pathlib2" ,python2-pathlib2)
763          ,@(package-propagated-inputs pytest))))))
765 (define-public python-pytest-bootstrap
766   (package
767     (inherit (strip-python2-variant python-pytest))
768     (name "python-pytest-bootstrap")
769     (native-inputs `(("python-setuptools-scm" ,python-setuptools-scm)))
770     (arguments `(#:tests? #f))
771     (properties `((python2-variant . ,(delay python2-pytest-bootstrap))))))
773 (define-public python2-pytest-bootstrap
774   (let ((pytest (package-with-python2
775                  (strip-python2-variant python-pytest-bootstrap))))
776     (package (inherit pytest)
777              (propagated-inputs
778               `(("python2-funcsigs" ,python2-funcsigs-bootstrap)
779                 ("python2-pathlib2" ,python2-pathlib2-bootstrap)
780                 ,@(package-propagated-inputs pytest))))))
782 (define-public python-pytest-cov
783   (package
784     (name "python-pytest-cov")
785     (version "2.6.1")
786     (source
787       (origin
788         (method url-fetch)
789         (uri (pypi-uri "pytest-cov" version))
790         (sha256
791          (base32 "0cyxbbghx2l4p60w10k00j1j74q1ngfiffr0pxn73ababjr69dha"))))
792     (build-system python-build-system)
793     (arguments
794      `(#:phases
795        (modify-phases %standard-phases
796          (replace 'check
797           (lambda _
798             ;; Options taken from tox.ini.
799             ;; TODO: make "--restructuredtext" tests pass. They currently fail
800             ;; with "Duplicate implicit target name".
801             (invoke "python" "./setup.py" "check"
802                     "--strict" "--metadata"))))))
803     (propagated-inputs
804      `(("python-coverage" ,python-coverage)
805        ("python-pytest" ,python-pytest)))
806     (home-page "https://github.com/pytest-dev/pytest-cov")
807     (synopsis "Pytest plugin for measuring coverage")
808     (description
809      "Pytest-cov produces coverage reports.  It supports centralised testing and
810 distributed testing in both @code{load} and @code{each} modes.  It also
811 supports coverage of subprocesses.")
812   (license license:expat)))
814 (define-public python2-pytest-cov
815   (package-with-python2 python-pytest-cov))
817 (define-public python-pytest-runner
818   (package
819     (name "python-pytest-runner")
820     (version "4.2")
821     (source
822      (origin
823        (method url-fetch)
824        (uri (pypi-uri "pytest-runner" version))
825        (sha256
826         (base32
827          "1gkpyphawxz38ni1gdq1fmwyqcg02m7ypzqvv46z06crwdxi2gyj"))))
828     (build-system python-build-system)
829     (native-inputs
830      `(("python-pytest" ,python-pytest-bootstrap)
831        ("python-setuptools-scm" ,python-setuptools-scm)))
832     (home-page "https://github.com/pytest-dev/pytest-runner")
833     (synopsis "Invoke py.test as a distutils command")
834     (description
835      "This package provides a @command{pytest-runner} command that
836 @file{setup.py} files can use to run tests.")
837     (license license:expat)))
839 (define-public python2-pytest-runner
840   (package-with-python2 python-pytest-runner))
842 (define-public python-pytest-mock
843   (package
844     (name "python-pytest-mock")
845     (version "1.10.1")
846     (source
847       (origin
848         (method url-fetch)
849         (uri (pypi-uri "pytest-mock" version))
850         (sha256
851          (base32
852           "1i5mg3ff1qk0wqfcxfz60hwy3q5dskdp36i10ckigkzffg8hc3ad"))))
853     (build-system python-build-system)
854     (native-inputs
855      `(("python-setuptools-scm" ,python-setuptools-scm)))
856     (propagated-inputs
857      `(("python-pytest" ,python-pytest)))
858     (home-page "https://github.com/pytest-dev/pytest-mock/")
859     (synopsis "Thin-wrapper around the mock package for easier use with py.test")
860     (description
861      "This plugin installs a @code{mocker} fixture which is a thin-wrapper
862 around the patching API provided by the @code{mock} package, but with the
863 benefit of not having to worry about undoing patches at the end of a test.
864 The mocker fixture has the same API as @code{mock.patch}, supporting the
865 same arguments.")
866     (properties `((python2-variant . ,(delay python2-pytest-mock))))
867     (license license:expat)))
869 (define-public python2-pytest-mock
870   (let ((base (package-with-python2
871                 (strip-python2-variant python-pytest-mock))))
872     (package (inherit base)
873       (propagated-inputs
874        `(("python2-mock" ,python2-mock)
875          ,@(package-propagated-inputs base))))))
877 (define-public python-pytest-xdist
878   (package
879     (name "python-pytest-xdist")
880     (version "1.25.0")
881     (source
882      (origin
883        (method url-fetch)
884        (uri (pypi-uri "pytest-xdist" version))
885        (sha256
886         (base32
887          "1d812apvcmshh2l8f38spqwb3bpp0x43yy7lyfpxxzc99h4r7y4n"))
888        (modules '((guix build utils)))
889        (snippet
890         '(begin
891            ;; Remove pre-compiled .pyc files from source.
892            (for-each delete-file-recursively
893                      (find-files "." "__pycache__" #:directories? #t))
894            (for-each delete-file (find-files "." "\\.pyc$"))
895            #t))))
896     (build-system python-build-system)
897     (arguments
898      '(#:tests? #f)) ;FIXME: Some tests are failing.
899        ;; #:phases
900        ;; (modify-phases %standard-phases
901        ;;   (delete 'check)
902        ;;   (add-after 'install 'check
903        ;;     (lambda* (#:key inputs outputs #:allow-other-keys)
904        ;;       (add-installed-pythonpath inputs outputs)
905        ;;       (zero? (system* "py.test" "-v")))))
906     (native-inputs
907      `(("python-setuptools-scm" ,python-setuptools-scm)))
908     (propagated-inputs
909      `(("python-execnet" ,python-execnet)
910        ("python-pytest" ,python-pytest)
911        ("python-py" ,python-py)))
912     (home-page
913      "https://github.com/pytest-dev/pytest-xdist")
914     (synopsis
915      "Plugin for py.test with distributed testing and loop-on-failing modes")
916     (description
917      "The pytest-xdist plugin extends py.test with some unique test execution
918 modes: parallelization, running tests in boxed subprocesses, the ability
919 to run tests repeatedly when failed, and the ability to run tests on multiple
920 Python interpreters or platforms.  It uses rsync to copy the existing
921 program code to a remote location, executes there, and then syncs the
922 result back.")
923     (license license:expat)))
925 (define-public python2-pytest-xdist
926   (package-with-python2 python-pytest-xdist))
928 (define-public python-pytest-timeout
929   (package
930     (name "python-pytest-timeout")
931     (version "1.3.3")
932     (source
933      (origin
934        (method url-fetch)
935        (uri (pypi-uri "pytest-timeout" version))
936        (sha256
937         (base32
938          "1cczcjhw4xx5sjkhxlhc5c1bkr7x6fcyx12wrnvwfckshdvblc2a"))))
939     (build-system python-build-system)
940     (propagated-inputs
941      `(("python-pytest" ,python-pytest)))
942     (home-page "http://bitbucket.org/pytest-dev/pytest-timeout/")
943     (synopsis "Plugin for py.test to abort hanging tests")
944     (description
945      "This package provides a py.test plugin that aborts hanging tests after a
946 timeout has been exceeded.")
947     (license license:expat)))
949 (define-public python-scripttest
950   (package
951     (name "python-scripttest")
952     (version "1.3")
953     (source
954      (origin
955        (method url-fetch)
956        (uri (pypi-uri "scripttest" version))
957        (sha256
958         (base32
959          "0f4w84k8ck82syys7yg9maz93mqzc8p5ymis941x034v44jzq74m"))))
960     (build-system python-build-system)
961     (native-inputs
962      `(("python-pytest" ,python-pytest)))
963     (home-page "http://pythonpaste.org/scripttest/")
964     (synopsis "Python library to test command-line scripts")
965     (description "Scripttest is a Python helper library for testing
966 interactive command-line applications.  With it you can run a script in a
967 subprocess and see the output as well as any file modifications.")
968     (license license:expat)))
970 (define-public python2-scripttest
971   (package-with-python2 python-scripttest))
973 (define-public python-testtools-bootstrap
974   (package
975     (name "python-testtools-bootstrap")
976     (version "2.3.0")
977     (source
978      (origin
979        (method url-fetch)
980        (uri (pypi-uri "testtools" version))
981        (sha256
982         (base32
983          "0n8519lk8aaa91vymz842831181wf7fss98hyllhygi3z1nfq9sq"))
984        (patches (search-patches "python-testtools.patch"))))
985     (build-system python-build-system)
986     (arguments '(#:tests? #f))
987     (propagated-inputs
988      `(("python-extras" ,python-extras)
989        ("python-fixtures" ,python-fixtures-bootstrap)
990        ("python-mimeparse" ,python-mimeparse)
991        ("python-pbr" ,python-pbr-minimal)
992        ("python-six" ,python-six)
993        ("python-traceback2" ,python-traceback2)
994        ("python-unittest2" ,python-unittest2)))
995     (home-page "https://github.com/testing-cabal/testtools")
996     (synopsis
997      "Extensions to the Python standard library unit testing framework")
998     (description
999      "This package is only for bootstrapping.  Do not use this.")
1000     (license license:psfl)))
1002 (define-public python2-testtools-bootstrap
1003   (package-with-python2 python-testtools-bootstrap))
1005 (define-public python-testtools
1006   (package
1007     (inherit python-testtools-bootstrap)
1008     (name "python-testtools")
1009     (arguments
1010      `(#:phases (modify-phases %standard-phases
1011                   (replace 'check
1012                     (lambda _
1013                       (invoke "python" "-m" "testtools.run"
1014                               "testtools.tests.test_suite"))))))
1015     (propagated-inputs
1016      `(("python-extras" ,python-extras)
1017        ("python-fixtures" ,python-fixtures)
1018        ("python-mimeparse" ,python-mimeparse)
1019        ("python-pbr" ,python-pbr)
1020        ("python-six" ,python-six)
1021        ("python-traceback2" ,python-traceback2)
1022        ("python-unittest2" ,python-unittest2)))
1023     (native-inputs
1024      `(("python-testscenarios" ,python-testscenarios-bootstrap)))
1025     (description
1026      "Testtools extends the Python standard library unit testing framework to
1027 provide matchers, more debugging information, and cross-Python
1028 compatibility.")))
1030 (define-public python2-testtools
1031   (package-with-python2 python-testtools))
1033 (define-public python-testscenarios-bootstrap
1034   (package
1035     (name "python-testscenarios-bootstrap")
1036     (version "0.5.0")
1037     (source
1038      (origin
1039        (method url-fetch)
1040        (uri (pypi-uri "testscenarios" version))
1041        (sha256
1042         (base32
1043          "1dm2aydqpv76vnsk1pw7k8n42hq58cfi4n1ixy7nyzpaj1mwnmy2"))))
1044     (build-system python-build-system)
1045     (arguments
1046      `(#:phases (modify-phases %standard-phases
1047                   (replace 'check
1048                     (lambda _
1049                       (invoke "python" "-m" "testtools.run"
1050                               "testscenarios.test_suite"))))))
1051     (propagated-inputs
1052      `(("python-pbr" ,python-pbr-minimal)
1053        ("python-testtools" ,python-testtools-bootstrap)))
1054     (home-page "https://launchpad.net/testscenarios")
1055     (synopsis "Pyunit extension for dependency injection")
1056     (description
1057      "This package is only for bootstrapping.  Don't use this.")
1058     (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
1060 (define-public python2-testscenarios-bootstrap
1061   (package-with-python2 python-testscenarios-bootstrap))
1063 (define-public python-testscenarios
1064   (package
1065     (inherit python-testscenarios-bootstrap)
1066     (name "python-testscenarios")
1067     (propagated-inputs
1068      `(("python-pbr" ,python-pbr)
1069        ("python-testtools" ,python-testtools)))
1070     (description
1071      "Testscenarios provides clean dependency injection for Python unittest
1072 style tests.")))
1074 (define-public python2-testscenarios
1075   (package-with-python2 python-testscenarios))
1077 ;; Testresources requires python-pbr at runtime, but pbr needs it for its
1078 ;; own tests.  Hence this bootstrap variant.
1079 (define-public python-testresources-bootstrap
1080   (package
1081     (name "python-testresources-bootstrap")
1082     (version "2.0.1")
1083     (source (origin
1084               (method url-fetch)
1085               (uri (pypi-uri "testresources" version))
1086               (sha256
1087                (base32
1088                 "05s4dsli9g17m1r3b1gvwicbbgq011hnpb2b9qnj27ja2n11k7gf"))))
1089     (build-system python-build-system)
1090     (arguments '(#:tests? #f))
1091     (propagated-inputs
1092      `(("python-pbr" ,python-pbr-minimal)))
1093     (home-page "https://launchpad.net/testresources")
1094     (synopsis
1095      "Pyunit extension for managing test resources")
1096     (description
1097      "This package is only here for bootstrapping purposes.  Use the regular
1098 testresources package instead.")
1099     (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
1101 (define-public python2-testresources-bootstrap
1102   (package-with-python2 python-testresources-bootstrap))
1104 (define-public python-testresources
1105   (package
1106     (inherit python-testresources-bootstrap)
1107     (name "python-testresources")
1108     (propagated-inputs
1109      `(("python-pbr" ,python-pbr)))
1110     (arguments '())
1111     (native-inputs
1112      `(("python-fixtures" ,python-fixtures)
1113        ("python-testtols" ,python-testtools)))
1114     (description
1115      "Testresources is an extension to Python's unittest to allow declarative
1116 use of resources by test cases.")))
1118 (define-public python2-testresources
1119   (package-with-python2 python-testresources))
1121 (define-public python-subunit-bootstrap
1122   (package
1123     (name "python-subunit-bootstrap")
1124     (version "1.3.0")
1125     (source
1126      (origin
1127        (method url-fetch)
1128        (uri (pypi-uri "python-subunit" version))
1129        (sha256
1130         (base32
1131          "1fsw8rsn1s3nklx06mayrg5rn2zbky6wwjc5z07s7rf1wjzfs1wn"))))
1132     (build-system python-build-system)
1133     (propagated-inputs
1134      `(("python-extras" ,python-extras)
1135        ("python-testtools" ,python-testtools-bootstrap)))
1136     (native-inputs
1137      `(("python-fixtures" ,python-fixtures-bootstrap)
1138        ("python-hypothesis" ,python-hypothesis)
1139        ("python-testscenarios" ,python-testscenarios-bootstrap)))
1140     (home-page "https://launchpad.net/subunit")
1141     (synopsis "Python implementation of the subunit protocol")
1142     (description
1143      "This package is here for bootstrapping purposes only.  Use the regular
1144 python-subunit package instead.")
1145     (license (list license:bsd-3 license:asl2.0)))) ; at the user's option
1147 (define-public python2-subunit-bootstrap
1148   (package-with-python2 python-subunit-bootstrap))
1150 (define-public python-subunit
1151   (package
1152     (inherit python-subunit-bootstrap)
1153     (name "python-subunit")
1154     (propagated-inputs
1155      `(("python-extras" ,python-extras)
1156        ("python-testtools" ,python-testtools)))
1157     (native-inputs
1158      `(("python-fixtures" ,python-fixtures)
1159        ("python-hypothesis" ,python-hypothesis)
1160        ("python-testscenarios" ,python-testscenarios)))
1161     (description
1162      "Python-subunit is a Python implementation of the subunit test streaming
1163 protocol.")))
1165 (define-public python2-subunit
1166   (package-with-python2 python-subunit))
1168 ;; Fixtures requires python-pbr at runtime, but pbr uses fixtures for its
1169 ;; own tests.  Hence this bootstrap variant.
1170 (define-public python-fixtures-bootstrap
1171   (package
1172     (name "python-fixtures-bootstrap")
1173     (version "3.0.0")
1174     (source (origin
1175               (method url-fetch)
1176               (uri (pypi-uri "fixtures" version))
1177               (sha256
1178                (base32
1179                 "1vxj29bzz3rd4pcy51d05wng9q9dh4jq6wx92yklsm7i6h1ddw7w"))))
1180     (build-system python-build-system)
1181     (arguments `(#:tests? #f))
1182     (propagated-inputs
1183      `(("python-pbr-minimal" ,python-pbr-minimal)
1184        ("python-six" ,python-six)))
1185     (home-page "https://launchpad.net/python-fixtures")
1186     (synopsis "Python test fixture library")
1187     (description
1188      "This package is only used for bootstrapping.  Use the regular
1189 python-fixtures package instead.")
1190     (license (list license:bsd-3 license:asl2.0)))) ; at user's option
1192 (define-public python2-fixtures-bootstrap
1193   (package-with-python2 python-fixtures-bootstrap))
1195 (define-public python-fixtures
1196   (package
1197     (inherit python-fixtures-bootstrap)
1198     (name "python-fixtures")
1199     (arguments
1200      '(#:phases
1201        (modify-phases %standard-phases
1202          (replace 'check
1203            (lambda _
1204              (invoke "python" "-m" "testtools.run"
1205                      "fixtures.test_suite"))))))
1206     (propagated-inputs
1207      ;; Fixtures uses pbr at runtime to check versions, etc.
1208      `(("python-pbr" ,python-pbr)
1209        ("python-six" ,python-six)))
1210     (native-inputs
1211      `(("python-mock" ,python-mock)
1212        ("python-testtools" ,python-testtools-bootstrap)))
1213     (description
1214      "Fixtures provides a way to create reusable state, useful when writing
1215 Python tests.")))
1217 (define-public python2-fixtures
1218   (package-with-python2 python-fixtures))
1220 (define-public python-testrepository-bootstrap
1221   (package
1222     (name "python-testrepository-bootstrap")
1223      (version "0.0.20")
1224     (source
1225      (origin
1226        (method url-fetch)
1227        (uri (pypi-uri "testrepository" version))
1228        (sha256
1229         (base32
1230          "1ssqb07c277010i6gzzkbdd46gd9mrj0bi0i8vn560n2k2y4j93m"))))
1231     (build-system python-build-system)
1232     (arguments '(#:tests? #f))
1233     (propagated-inputs
1234      `(("python-fixtures" ,python-fixtures-bootstrap)
1235        ("python-subunit" ,python-subunit-bootstrap)
1236        ("python-testtools" ,python-testtools-bootstrap)))
1237     (native-inputs
1238      `(("python-mimeparse" ,python-mimeparse)))
1239     (home-page "https://launchpad.net/testrepository")
1240     (synopsis "Database for Python test results")
1241     (description
1242      "Bootstrap package for python-testrepository.  Don't use this.")
1243     (license (list license:bsd-3 license:asl2.0)))) ; at user's option
1245 (define-public python2-testrepository-bootstrap
1246   (package-with-python2 python-testrepository-bootstrap))
1248 (define-public python-testrepository
1249   (package
1250     (inherit python-testrepository-bootstrap)
1251     (name "python-testrepository")
1252     (arguments
1253      ;; FIXME: Many tests are failing.
1254      '(#:tests? #f))
1255     (propagated-inputs
1256      `(("python-fixtures" ,python-fixtures)
1257        ("python-subunit" ,python-subunit)
1258        ("python-testtools" ,python-testtools)))
1259     (native-inputs
1260      `(("python-mimeparse" ,python-mimeparse)))
1261     (description "Testrepository provides a database of test results which can
1262 be used as part of a developer's workflow to check things such as what tests
1263 have failed since the last commit or what tests are currently failing.")))
1265 (define-public python2-testrepository
1266   (package-with-python2 python-testrepository))
1268 (define-public python-coverage
1269   (package
1270     (name "python-coverage")
1271     (version "4.4.1")
1272     (source
1273      (origin
1274        (method url-fetch)
1275        (uri (pypi-uri "coverage" version))
1276        (sha256
1277         (base32
1278          "097l4s3ssxm1vncsn0nw3a1pbzah28773q36c1ab9wz01r04973s"))))
1279     (build-system python-build-system)
1280     (arguments
1281      ;; FIXME: 95 tests failed, 539 passed, 6 skipped, 2 errors.
1282      '(#:tests? #f))
1283     (home-page "http://nedbatchelder.com/code/coverage")
1284     (synopsis "Code coverage measurement for Python")
1285     (description
1286      "Coverage measures code coverage, typically during test execution.  It
1287 uses the code analysis tools and tracing hooks provided in the Python standard
1288 library to determine which lines are executable, and which have been
1289 executed.")
1290     (license license:bsd-3)))
1292 (define-public python2-coverage
1293   (package-with-python2 python-coverage))
1295 (define-public python-cov-core
1296   (package
1297     (name "python-cov-core")
1298     (version "1.15.0")
1299     (source
1300       (origin
1301         (method url-fetch)
1302         (uri (pypi-uri "cov-core" version))
1303         (sha256
1304          (base32
1305           "0k3np9ymh06yv1ib96sb6wfsxjkqhmik8qfsn119vnhga9ywc52a"))))
1306     (build-system python-build-system)
1307     (propagated-inputs
1308      `(("python-coverage" ,python-coverage)))
1309     (home-page "https://github.com/schlamar/cov-core")
1310     (synopsis "Coverage plugin core for pytest-cov, nose-cov and nose2-cov")
1311     (description
1312      "This is a library package for use by @code{pytest-cov}, @code{nose-cov}
1313 and @code{nose2-cov}.  It is useful for developing coverage plugins for these
1314 testing frameworks.")
1315     (license license:expat)))
1317 (define-public python2-cov-core
1318  (package-with-python2 python-cov-core))
1320 (define-public python-codecov
1321   (package
1322     (name "python-codecov")
1323     (version "2.0.15")
1324     (source
1325       (origin
1326         (method url-fetch)
1327         (uri (pypi-uri "codecov" version))
1328         (sha256
1329          (base32
1330           "1217c0vqf7ii65635gvl27a5pfhv0r7zhrpdp9cx640hg73bgn4f"))))
1331     (build-system python-build-system)
1332     (native-inputs
1333      `(("python-unittest2" ,python-unittest2)))
1334     (propagated-inputs
1335      `(("python-coverage" ,python-coverage)
1336        ("python-requests" ,python-requests)))
1337     (home-page "http://github.com/codecov/codecov-python")
1338     (synopsis "Upload code coverage reports to @code{codecov.io}")
1339     (description
1340      "Codecov collects code coverage reports from code written in Python, Java,
1341 C/C++, R, and more, and uploads it to the @code{codecov.io} service.")
1342     (license license:asl2.0)))
1344 (define-public python-testpath
1345   (package
1346     (name "python-testpath")
1347     (version "0.2")
1348     (source
1349      (origin
1350        (method git-fetch)
1351        (uri (git-reference
1352               (url "https://github.com/jupyter/testpath")
1353               (commit version)))
1354        (file-name (git-file-name name version))
1355        (sha256
1356         (base32
1357          "0r4iiizjql6ny1ln7ciw7rrbjadz1s9zrf2hl0xkgnh3ypd8936f"))))
1358     (build-system python-build-system)
1359     (arguments
1360      `(#:tests? #f ; this package does not even have a setup.py
1361        #:modules ((guix build python-build-system)
1362                   (guix build utils)
1363                   (srfi srfi-1))
1364        #:imported-modules (,@%python-build-system-modules
1365                            (srfi srfi-1))
1366        #:phases
1367        (modify-phases %standard-phases
1368          (delete 'install)
1369          (replace 'build
1370            (lambda* (#:key inputs outputs #:allow-other-keys)
1371              (let* ((version (last
1372                               (string-split (assoc-ref inputs "python") #\-)))
1373                     (x.y (string-join (take (string-split version #\.) 2)
1374                                         "."))
1375                     (dir (string-append
1376                           (assoc-ref outputs "out")
1377                           "/lib/python" x.y "/site-packages/testpath")))
1378                (mkdir-p dir)
1379                (copy-recursively "testpath" dir))
1380              #t)))))
1381     (home-page "https://github.com/takluyver/testpath")
1382     (synopsis "Test utilities for code working with files and commands")
1383     (description
1384      "Testpath is a collection of utilities for Python code working with files
1385 and commands.  It contains functions to check things on the file system, and
1386 tools for mocking system commands and recording calls to those.")
1387     (license license:expat)))
1389 (define-public python2-testpath
1390   (package-with-python2 python-testpath))
1392 (define-public python-testlib
1393   (package
1394     (name "python-testlib")
1395     (version "0.6.5")
1396     (source
1397      (origin
1398        (method url-fetch)
1399        (uri (pypi-uri "testlib" version ".zip"))
1400        (sha256
1401         (base32 "1mz26cxn4x8bbgv0rn0mvj2z05y31rkc8009nvdlb3lam5b4mj3y"))))
1402     (build-system python-build-system)
1403     (native-inputs
1404      `(("unzip" ,unzip)))  ; for unpacking the source
1405     (synopsis "Python micro test suite harness")
1406     (description "A micro unittest suite harness for Python.")
1407     (home-page "https://github.com/trentm/testlib")
1408     (license license:expat)))
1410 (define-public python2-testlib
1411   (package-with-python2 python-testlib))
1413 ;;; The software provided by this package was integrated into pytest 2.8.
1414 (define-public python-pytest-cache
1415   (package
1416     (name "python-pytest-cache")
1417     (version "1.0")
1418     (source (origin
1419              (method url-fetch)
1420              (uri (pypi-uri "pytest-cache" version))
1421              (sha256
1422               (base32
1423                "1a873fihw4rhshc722j4h6j7g3nj7xpgsna9hhg3zn6ksknnhx5y"))))
1424     (build-system python-build-system)
1425     (propagated-inputs
1426      `(("python-apipkg" ,python-apipkg)
1427        ("python-execnet" ,python-execnet)
1428        ("python-py" ,python-py)
1429        ("python-pytest" ,python-pytest)))
1430     (synopsis "Py.test plugin with mechanisms for caching across test runs")
1431     (description "The pytest-cache plugin provides tools to rerun failures from
1432 the last py.test invocation.")
1433     (home-page "https://bitbucket.org/hpk42/pytest-cache/")
1434     (license license:expat)))
1436 (define-public python2-pytest-cache
1437   (package-with-python2 python-pytest-cache))
1439 (define-public python-pytest-localserver
1440   (package
1441     (name "python-pytest-localserver")
1442     (version "0.5.0")
1443     (source (origin
1444               (method url-fetch)
1445               (uri (pypi-uri "pytest-localserver" version))
1446               (sha256
1447                (base32
1448                 "1hpgpxrpfq5c731ndnsay2lc0y9nh2wy9fn1f83s3z8xkn82fm1s"))))
1449     (build-system python-build-system)
1450     (arguments
1451      '(#:phases
1452        (modify-phases %standard-phases
1453          (replace 'check
1454            (lambda _
1455              (invoke "py.test" "-v"))))))
1456     (native-inputs
1457      `(("python-pytest" ,python-pytest)
1458        ("python-requests" ,python-requests)
1459        ("python-six" ,python-six)))
1460     (propagated-inputs
1461      `(("python-werkzeug" ,python-werkzeug)))
1462     (synopsis "Py.test plugin to test server connections locally")
1463     (description "Pytest-localserver is a plugin for the pytest testing
1464 framework which enables you to test server connections locally.")
1465     (home-page "https://pypi.python.org/pypi/pytest-localserver")
1466     (license license:expat)))
1468 (define-public python-pytest-xprocess
1469   (package
1470     (name "python-pytest-xprocess")
1471     (version "0.9.1")
1472     (source (origin
1473              (method url-fetch)
1474              (uri (pypi-uri "pytest-xprocess" version))
1475              (sha256
1476               (base32
1477                "17zlql1xqw3ywcgwwbqmw633aly99lab12hm02asr8awvg5603pp"))))
1478     (build-system python-build-system)
1479     (propagated-inputs
1480      `(("python-pytest" ,python-pytest)
1481        ("python-pytest-cache" ,python-pytest-cache)
1482        ("python-psutil" ,python-psutil)))
1483     (synopsis "Pytest plugin to manage external processes across test runs")
1484     (description "Pytest-xprocess is an experimental py.test plugin for managing
1485 processes across test runs.")
1486     (home-page "https://bitbucket.org/pytest-dev/pytest-xprocess")
1487     (license license:expat)))
1489 (define-public python-pytest-subtesthack
1490   (package
1491     (name "python-pytest-subtesthack")
1492     (version "0.1.1")
1493     (source (origin
1494               (method url-fetch)
1495               (uri (pypi-uri "pytest-subtesthack" version))
1496               (sha256
1497                (base32
1498                 "15kzcr5pchf3id4ikdvlv752rc0j4d912n589l4rifp8qsj19l1x"))))
1499     (build-system python-build-system)
1500     (propagated-inputs
1501      `(("python-pytest" ,python-pytest)))
1502     (synopsis "Set-up and tear-down fixtures for unit tests")
1503     (description "This plugin allows you to set up and tear down fixtures within
1504 unit test functions that use @code{py.test}. This is useful for using
1505 @command{hypothesis} inside py.test, as @command{hypothesis} will call the test
1506 function multiple times, without setting up or tearing down fixture state as is
1507 normally the case.")
1508     (home-page "https://github.com/untitaker/pytest-subtesthack/")
1509     (license license:unlicense)))
1511 (define-public python2-pytest-subtesthack
1512   (package-with-python2 python-pytest-subtesthack))
1514 (define-public python-pytest-sugar
1515   (package
1516     (name "python-pytest-sugar")
1517     (version "0.9.2")
1518     (source
1519      (origin
1520        (method url-fetch)
1521        (uri (pypi-uri "pytest-sugar" version))
1522        (sha256
1523         (base32
1524          "1asq7yc4g8bx2sn7yy974mhc9ywvaihasjab4inkirdwn9s7mn7w"))))
1525     (build-system python-build-system)
1526     (propagated-inputs
1527      `(("python-packaging" ,python-packaging)
1528        ("python-pytest" ,python-pytest)
1529        ("python-termcolor" ,python-termcolor)))
1530     (home-page "https://pivotfinland.com/pytest-sugar/")
1531     (synopsis "Plugin for pytest that changes the default look and feel")
1532     (description
1533      "@code{pytest-sugar} is a plugin for py.test that changes the default
1534 look and feel of py.test, using a progress bar and showing failures and errors
1535 instantly.")
1536     (license license:bsd-3)))
1538 (define-public python-hypothesis
1539   (package
1540     (name "python-hypothesis")
1541     (version "3.70.3")
1542     (source (origin
1543               (method url-fetch)
1544               (uri (pypi-uri "hypothesis" version))
1545               (sha256
1546                (base32
1547                 "1rshs1japfmwgar98yrkq4hg4z2q76hlnq7w2n3lfbjnscn1jd9b"))))
1548     (build-system python-build-system)
1549     (native-inputs
1550      `(;; FIXME: Change to python-flake8 in the next rebuild cycle.
1551        ("python-flake8" ,python-flake8-3.5)
1552        ("python-pytest" ,python-pytest-bootstrap)))
1553     (propagated-inputs
1554      `(("python-attrs" ,python-attrs-bootstrap)
1555        ("python-coverage" ,python-coverage)))
1556     (synopsis "Library for property based testing")
1557     (description "Hypothesis is a library for testing your Python code against a
1558 much larger range of examples than you would ever want to write by hand.  It’s
1559 based on the Haskell library, Quickcheck, and is designed to integrate
1560 seamlessly into your existing Python unit testing work flow.")
1561     (home-page "https://github.com/HypothesisWorks/hypothesis-python")
1562     (license license:mpl2.0)
1563     (properties `((python2-variant . ,(delay python2-hypothesis))))))
1565 (define-public python2-hypothesis
1566   (let ((hypothesis (package-with-python2
1567                      (strip-python2-variant python-hypothesis))))
1568     (package (inherit hypothesis)
1569       (propagated-inputs
1570        `(("python2-enum34" ,python2-enum34)
1571          ,@(package-propagated-inputs hypothesis))))))
1573 (define-public python-lit
1574   (package
1575     (name "python-lit")
1576     (version "0.5.1")
1577     (source
1578       (origin
1579         (method url-fetch)
1580         (uri (pypi-uri "lit" version))
1581         (sha256
1582          (base32
1583           "0z651m3vkbk85y41larnsjxrszkbi58x9gzml3lb6ga7qwcrsg97"))))
1584     (build-system python-build-system)
1585     (arguments
1586      `(#:phases
1587        (modify-phases %standard-phases
1588          (replace 'check
1589            (lambda _
1590              (invoke "python" "lit.py" "tests"))))))
1591     (native-inputs
1592      `(("llvm" ,llvm)))
1593     (home-page "https://llvm.org/")
1594     (synopsis "LLVM Software Testing Tool")
1595     (description "@code{lit} is a portable tool for executing LLVM and Clang
1596 style test suites, summarizing their results, and providing indication of
1597 failures.")
1598     (license license:ncsa)))
1600 (define-public python2-lit
1601   (package-with-python2 python-lit))
1603 (define-public python-pytest-pep8
1604   (package
1605     (name "python-pytest-pep8")
1606     (version "1.0.6")
1607     (source (origin
1608               (method url-fetch)
1609               (uri (pypi-uri "pytest-pep8" version))
1610               (sha256
1611                (base32
1612                 "06032agzhw1i9d9qlhfblnl3dw5hcyxhagn7b120zhrszbjzfbh3"))))
1613     (build-system python-build-system)
1614     (arguments
1615      `(#:tests? #f)) ; Fails with recent pytest and pep8. See upstream issues #8 and #12.
1616     (native-inputs
1617      `(("python-pytest" ,python-pytest)))
1618     (propagated-inputs
1619      `(("python-pep8" ,python-pep8)))
1620     (home-page "https://bitbucket.org/pytest-dev/pytest-pep8")
1621     (synopsis "Py.test plugin to check PEP8 requirements")
1622     (description "Pytest plugin for checking PEP8 compliance.")
1623     (license license:expat)))
1625 (define-public python2-pytest-pep8
1626   (package-with-python2 python-pytest-pep8))
1628 (define-public python-pytest-flakes
1629   (package
1630     (name "python-pytest-flakes")
1631     (version "1.0.1")
1632     (source (origin
1633               (method url-fetch)
1634               (uri (pypi-uri "pytest-flakes" version))
1635               (sha256
1636                (base32
1637                 "0flag3n33kbhyjrhzmq990rvg4yb8hhhl0i48q9hw0ll89jp28lw"))))
1638     (build-system python-build-system)
1639     (arguments
1640      `(#:phases
1641        (modify-phases %standard-phases
1642          (delete 'check)
1643          (add-after 'install 'check
1644            (lambda* (#:key outputs inputs #:allow-other-keys)
1645              ;; It's easier to run tests after install.
1646              ;; Make installed package available for running the tests
1647              (add-installed-pythonpath inputs outputs)
1648              (invoke "py.test" "-vv"))))))
1649     (native-inputs
1650      `(("python-coverage" ,python-coverage)
1651        ("python-pytest" ,python-pytest)
1652        ("python-pytest-cache" ,python-pytest-cache)
1653        ("python-pytest-pep8" ,python-pytest-pep8)))
1654     (propagated-inputs
1655      `(("python-pyflakes" ,python-pyflakes)))
1656     (home-page "https://github.com/fschulze/pytest-flakes")
1657     (synopsis "Py.test plugin to check source code with pyflakes")
1658     (description "Pytest plugin for checking Python source code with pyflakes.")
1659     (license license:expat)))
1661 (define-public python2-pytest-flakes
1662   (package-with-python2 python-pytest-flakes))
1664 (define-public python2-coverage-test-runner
1665   (package
1666     (name "python2-coverage-test-runner")
1667     (version "1.15")
1668     (source
1669      (origin
1670        (method url-fetch)
1671        (uri (string-append
1672              "http://git.liw.fi/cgi-bin/cgit/cgit.cgi/"
1673              "coverage-test-runner/snapshot/coverage-test-runner-"
1674              version ".tar.gz"))
1675        (sha256
1676         (base32
1677          "1kjjb9llckycnfxag8zcvqsn4z1s3dwyw6b1n0avxydihgf30rny"))))
1678     (build-system python-build-system)
1679     (arguments
1680      `(#:python ,python-2
1681        #:phases
1682        (modify-phases %standard-phases
1683          (replace 'check
1684            (lambda _
1685              (invoke "./testrun"))))))
1686     (propagated-inputs
1687      `(("python2-coverage" ,python2-coverage)))
1688     (home-page "https://liw.fi/coverage-test-runner/")
1689     (synopsis "Python module for running unit tests")
1690     (description "@code{CoverageTestRunner} is a python module for running
1691 unit tests and failing them if the unit test module does not exercise all
1692 statements in the module it tests.")
1693     (license license:gpl3+)))
1695 (define-public python-pylint
1696   (package
1697     (name "python-pylint")
1698     (version "1.7.2")
1699     (source
1700      (origin
1701        (method url-fetch)
1702        (uri (string-append
1703              "https://github.com/PyCQA/pylint/archive/pylint-"
1704              version ".tar.gz"))
1705        (sha256
1706         (base32
1707          "0mzn1czhf1mgr2wiqfihb274sja02h899b85kywdpivppa9nwrmp"))))
1708     (build-system python-build-system)
1709     (native-inputs
1710      `(("python-pytest" ,python-pytest)
1711        ("python-pytest-runner" ,python-pytest-runner)
1712        ("python-tox" ,python-tox)))
1713     (propagated-inputs
1714      `(("python-astroid" ,python-astroid)
1715        ("python-isort" ,python-isort)
1716        ("python-mccabe" ,python-mccabe)
1717        ("python-six" ,python-six)))
1718     (arguments
1719      `(#:phases
1720        (modify-phases %standard-phases
1721          (replace 'check
1722                   (lambda _
1723                     ;; Somehow, tests for python2-pylint
1724                     ;; fail if run from the build directory
1725                     (let ((work "/tmp/work"))
1726                       (mkdir-p work)
1727                       (setenv "PYTHONPATH"
1728                               (string-append (getenv "PYTHONPATH") ":" work))
1729                       (copy-recursively "." work)
1730                       (with-directory-excursion "/tmp"
1731                         (invoke "python" "-m" "unittest" "discover"
1732                                 "-s" (string-append work "/pylint/test")
1733                                 "-p" "*test_*.py"))))))))
1734     (home-page "https://github.com/PyCQA/pylint")
1735     (synopsis "Python source code analyzer which looks for coding standard
1736 errors")
1737     (description "Pylint is a Python source code analyzer which looks
1738 for programming errors, helps enforcing a coding standard and sniffs
1739 for some code smells (as defined in Martin Fowler's Refactoring book).
1741 Pylint has many rules enabled by default, way too much to silence them
1742 all on a minimally sized program.  It's highly configurable and handle
1743 pragmas to control it from within your code.  Additionally, it is
1744 possible to write plugins to add your own checks.")
1745     (properties `((python2-variant . ,(delay python2-pylint))))
1746     (license license:gpl2+)))
1748 (define-public python2-pylint
1749   (let ((pylint (package-with-python2
1750                   (strip-python2-variant python-pylint))))
1751     (package (inherit pylint)
1752              (propagated-inputs
1753               `(("python2-backports-functools-lru-cache"
1754                  ,python2-backports-functools-lru-cache)
1755                 ("python2-configparser" ,python2-configparser)
1756                 ,@(package-propagated-inputs pylint))))))
1758 (define-public python-paramunittest
1759   (package
1760     (name "python-paramunittest")
1761     (version "0.2")
1762     (source
1763      (origin
1764        (method url-fetch)
1765        (uri (pypi-uri "ParamUnittest" version))
1766        (sha256
1767         (base32
1768          "0kp793hws5xv1wvycxq7jw2pwy36f35k39jg8hx5qikij5a0jid1"))))
1769     (build-system python-build-system)
1770     (home-page
1771      "https://github.com/rik0/ParamUnittest")
1772     (synopsis
1773      "Simple extension to have parametrized unit tests")
1774     (description
1775      "This package allows to create parametrized unit-tests that work with the standard
1776 unittest package.  A parametrized test case is automatically converted to multiple test
1777 cases.  Since they are TestCase subclasses, they work with other test suites that
1778 recognize TestCases.")
1779     (license license:bsd-2)))
1781 (define-public python2-python-paramunittest
1782   (package-with-python2 python-paramunittest))
1784 (define-public python-pytest-warnings
1785   (package
1786     (name "python-pytest-warnings")
1787     (version "0.2.0")
1788     (source
1789      (origin
1790        (method url-fetch)
1791        (uri (pypi-uri "pytest-warnings" version))
1792        (sha256
1793         (base32
1794          "0gf2dpahpl5igb7jh1sr9acj3z3gp7zahqdqb69nk6wx01c8kc1g"))))
1795     (build-system python-build-system)
1796     (propagated-inputs
1797      `(("pytest" ,python-pytest)))
1798     (home-page "https://github.com/fschulze/pytest-warnings")
1799     (synopsis "Pytest plugin to list Python warnings in pytest report")
1800     (description
1801      "Python-pytest-warnings is a pytest plugin to list Python warnings in
1802 pytest report.")
1803     (license license:expat)
1804     (properties `((python2-variant . ,(delay python2-pytest-warnings))
1805                   ;; This package is part of pytest as of version 3.1.0.
1806                   (superseded . ,python-pytest)))))
1808 (define-public python2-pytest-warnings
1809   (package (inherit (package-with-python2
1810                      (strip-python2-variant python-pytest-warnings)))
1811            (properties `((superseded . ,python2-pytest)))))
1813 (define-public python-pytest-capturelog
1814   (package
1815     (name "python-pytest-capturelog")
1816     (version "0.7")
1817     (source
1818      (origin
1819        (method url-fetch)
1820        (uri (pypi-uri "pytest-capturelog" version ".tar.gz"))
1821        (sha256
1822         (base32
1823          "038049nyjl7di59ycnxvc9nydivc5m8np3hqq84j2iirkccdbs5n"))))
1824     (build-system python-build-system)
1825     (propagated-inputs
1826      `(("pytest" ,python-pytest)))
1827     (home-page "https://bitbucket.org/memedough/pytest-capturelog/overview")
1828     (synopsis "Pytest plugin to catch log messages")
1829     (description
1830      "Python-pytest-catchlog is a pytest plugin to catch log messages.")
1831     (license license:expat)))
1833 (define-public python2-pytest-capturelog
1834   (package-with-python2 python-pytest-capturelog))
1836 (define-public python-pytest-catchlog
1837   (package
1838     (name "python-pytest-catchlog")
1839     (version "1.2.2")
1840     (source
1841      (origin
1842        (method url-fetch)
1843        (uri (pypi-uri "pytest-catchlog" version ".zip"))
1844        (sha256
1845         (base32
1846          "1w7wxh27sbqwm4jgwrjr9c2gy384aca5jzw9c0wzhl0pmk2mvqab"))))
1847     (build-system python-build-system)
1848     (native-inputs
1849      `(("unzip" ,unzip)))
1850     (propagated-inputs
1851      `(("pytest" ,python-pytest)))
1852     (home-page "https://github.com/eisensheng/pytest-catchlog")
1853     (synopsis "Pytest plugin to catch log messages")
1854     (description
1855      "Python-pytest-catchlog is a pytest plugin to catch log messages.  This is
1856 a fork of pytest-capturelog.")
1857     (license license:expat)))
1859 (define-public python2-pytest-catchlog
1860   (package-with-python2 python-pytest-catchlog))
1862 (define-public python-nosexcover
1863   (package
1864     (name "python-nosexcover")
1865     (version "1.0.11")
1866     (source (origin
1867               (method url-fetch)
1868               (uri (pypi-uri "nosexcover" version))
1869               (sha256
1870                (base32
1871                 "10xqr12qv62k2flxwqhh8cr00cjhn7sfjrm6p35gd1x5bmjkr319"))))
1872     (build-system python-build-system)
1873     (propagated-inputs
1874      `(("python-coverage" ,python-coverage)
1875        ("python-nose" ,python-nose)))
1876     (home-page "http://github.com/cmheisel/nose-xcover")
1877     (synopsis "Extends nose.plugins.cover to add Cobertura-style XML reports")
1878     (description "Nose-xcover is a companion to the built-in
1879 @code{nose.plugins.cover}.  This plugin will write out an XML coverage report
1880 to a file named coverage.xml.
1882 It will honor all the options you pass to the Nose coverage plugin,
1883 especially -cover-package.")
1884     (license license:expat)))
1886 (define-public python2-nosexcover
1887   (package-with-python2 python-nosexcover))
1889 (define-public python-discover
1890   (package
1891     (name "python-discover")
1892     (version "0.4.0")
1893     (source
1894      (origin
1895        (method url-fetch)
1896        (uri (pypi-uri "discover" version))
1897        (sha256
1898         (base32
1899          "0y8d0zwiqar51kxj8lzmkvwc3b8kazb04gk5zcb4nzg5k68zmhq5"))))
1900     (build-system python-build-system)
1901     (home-page "http://pypi.python.org/pypi/discover/")
1902     (synopsis
1903      "Python test discovery for unittest")
1904     (description
1905      "Discover provides test discovery for unittest, a feature that has been
1906 backported from Python 2.7 for Python 2.4+.")
1907     (license license:bsd-3)))
1909 (define-public python2-discover
1910   (package-with-python2 python-discover))
1912 (define-public behave
1913   (package
1914     (name "behave")
1915     (version "1.2.6")
1916     (source (origin
1917              (method url-fetch)
1918              (uri (pypi-uri "behave" version))
1919              (sha256
1920               (base32
1921                "11hsz365qglvpp1m1w16239c3kiw15lw7adha49lqaakm8kj6rmr"))))
1922     (build-system python-build-system)
1923     (native-inputs
1924      `(("python-mock" ,python-mock)
1925        ("python-nose" ,python-nose)
1926        ("python-pathpy" ,python-pathpy)
1927        ("python-pyhamcrest" ,python-pyhamcrest)
1928        ("python-pytest" ,python-pytest)))
1929     (propagated-inputs
1930      `(("python-six" ,python-six)
1931        ("python-parse" ,python-parse)
1932        ("python-parse-type" ,python-parse-type)))
1933     (arguments
1934      '(#:test-target "behave_test"))
1935     (home-page "https://github.com/behave/behave")
1936     (synopsis "Python behavior-driven development")
1937     (description
1938      "Behave is a tool for behavior-driven development in python.
1939 Behavior-driven development (or BDD) is an agile software development
1940 technique that encourages collaboration between developers, QA and
1941 non-technical or business participants in a software project.  Behave uses
1942 tests written in a natural language style, backed up by Python code.")
1943     (license license:x11)))
1945 (define-public python-behave-web-api
1946   (package
1947     (name "python-behave-web-api")
1948     (version "1.0.6")
1949     (source
1950      (origin
1951        (method url-fetch)
1952        (uri (pypi-uri "behave-web-api" version))
1953        (sha256
1954         (base32
1955          "03kpq2xsy1gab3jy0dccbxlsg7vwfy4lagss0qldwmx3xz6b3i19"))))
1956     (build-system python-build-system)
1957     (arguments
1958      `(#:phases
1959        (modify-phases %standard-phases
1960          (add-after 'unpack 'fix-dependencies
1961            (lambda _
1962              (substitute* "setup.py"
1963                (("'wheel'") "")                ; We don't use it.
1964                (("'ordereddict==1.1'") ""))    ; Python >= 2.7 has it built-in.
1965              #t)))))
1966     (propagated-inputs
1967      `(("behave" ,behave)
1968        ("python-requests" ,python-requests)))
1969     (home-page "https://github.com/jefersondaniel/behave-web-api")
1970     (synopsis "Provides testing for JSON APIs with Behave for Python")
1971     (description "This package provides testing utility modules for testing
1972 JSON APIs with Behave.")
1973     (license license:expat)))
1975 (define-public python2-behave-web-api
1976   (package-with-python2 python-behave-web-api))
1978 (define-public python-rednose
1979   (package
1980     (name "python-rednose")
1981     (version "1.2.3")
1982     (source
1983       (origin
1984         (method url-fetch)
1985         (uri (pypi-uri "rednose" version))
1986         (sha256
1987           (base32
1988             "11x5nx5b4wdq04s7vj1gcdl07jvvkfb37p0r5lg773gr5rr8mj6h"))))
1989     (build-system python-build-system)
1990     (arguments
1991      `(#:phases (modify-phases %standard-phases
1992                   (add-after 'unpack 'patch-setup.py
1993                     (lambda _
1994                       ;; Six is only required for tests and later versions
1995                       ;; work fine.
1996                       (substitute* "setup.py"
1997                         (("six==1.10.0") "six"))
1998                       #t)))))
1999     (propagated-inputs
2000      `(("python-colorama" ,python-colorama)
2001        ("python-termstyle" ,python-termstyle)))
2002     (native-inputs
2003      `(("python-six" ,python-six)
2004        ("python-nose" ,python-nose)))
2005     (home-page "https://github.com/JBKahn/rednose")
2006     (synopsis "Colored output for Python nosetests")
2007     (description "This package provides colored output for the
2008 @command{nosetests} command of the Python Nose unit test framework.")
2009     (license license:bsd-3)))
2011 (define-public python2-rednose
2012   (package-with-python2 python-rednose))
2014 (define-public python-nose-randomly
2015   (package
2016     (name "python-nose-randomly")
2017     (version "1.2.6")
2018     (source
2019      (origin
2020        (method url-fetch)
2021        (uri (pypi-uri "nose-randomly" version))
2022        (sha256
2023         (base32 "0z662rqhfk4bjmg806mn4frb8nz4gbh7mrddsrhfffp1g4yklj3y"))))
2024     (build-system python-build-system)
2025     (native-inputs
2026      `(("python-nose" ,python-nose)
2027        ("python-numpy" ,python-numpy)))
2028     (home-page "https://github.com/adamchainz/nose-randomly")
2029     (synopsis
2030      "Nose plugin to randomly order tests and control random.seed")
2031     (description
2032      "This is a @code{Nose} plugin to randomly order tests which can be quite
2033 powerful in discovering hidden flaws in the tests themselves, while helping to
2034 reduce inter-test dependencies.  It also helps in controlling @code{random.seed},
2035 by resetting it to a repeatable number for each test, enabling the tests to
2036 create data based on random numbers and yet remain repeatable.")
2037     (license license:bsd-3)))
2039 (define-public python2-nose-randomly
2040   (package-with-python2 python-nose-randomly))
2042 (define-public python-nose-timer
2043   (package
2044     (name "python-nose-timer")
2045     (version "0.7.5")
2046     (source
2047       (origin
2048         (method url-fetch)
2049         (uri (pypi-uri "nose-timer" version))
2050         (sha256
2051           (base32 "05wzkc88vbzw62pqkvhl33211b90kns0lny70b7qw62rcg4flzk4"))))
2052     (build-system python-build-system)
2053     (propagated-inputs
2054      `(("python-nose" ,python-nose)
2055        ("python-termcolor" ,python-termcolor)))
2056     (home-page "https://github.com/mahmoudimus/nose-timer")
2057     (synopsis "Timer plugin for nosetests")
2058     (description "Shows how much time was needed to run individual tests.")
2059     (license license:expat)))
2061 (define-public python2-nose-timer
2062   (package-with-python2 python-nose-timer))
2064 (define-public python-freezegun
2065   (package
2066     (name "python-freezegun")
2067     (version "0.3.12")
2068     (source
2069      (origin
2070        (method url-fetch)
2071        (uri (pypi-uri "freezegun" version))
2072        (sha256
2073         (base32 "1rx57v8ryjncjimg8hys9kx1r3rknvwcl4y340g20jn0sf69qk9a"))))
2074     (build-system python-build-system)
2075     (native-inputs
2076      `(("python-mock" ,python-mock)
2077        ("python-pytest" ,python-pytest)))
2078     (propagated-inputs
2079      `(("python-six" ,python-six)
2080        ("python-dateutil" ,python-dateutil)))
2081     (arguments
2082      `(#:phases
2083        (modify-phases %standard-phases
2084          ;; The tests are normally executed via `make test`, but the PyPi
2085          ;; package does not include the Makefile.
2086          (replace 'check
2087            (lambda _
2088              (invoke "pytest" "-vv"))))))
2089     (home-page "https://github.com/spulec/freezegun")
2090     (synopsis "Test utility for mocking the datetime module")
2091     (description
2092      "FreezeGun is a library that allows your python tests to travel through
2093 time by mocking the datetime module.")
2094     (license license:asl2.0)))
2096 (define-public python2-freezegun
2097   (package-with-python2 python-freezegun))
2099 (define-public python-flexmock
2100   (package
2101     (name "python-flexmock")
2102     (version "0.10.4")
2103     (source (origin
2104               (method url-fetch)
2105               (uri (pypi-uri "flexmock" version))
2106               (sha256
2107                (base32
2108                 "0b6qw3grhgx58kxlkj7mdma7xdvlj02zabvcf7w2qifnfjwwwcsh"))))
2109     (build-system python-build-system)
2110     (home-page "https://flexmock.readthedocs.org")
2111     (synopsis "Testing library for Python")
2112     (description
2113      "flexmock is a testing library for Python that makes it easy to create
2114 mocks, stubs and fakes.")
2115     (license license:bsd-3)))
2117 (define-public python2-flexmock
2118   (package-with-python2 python-flexmock))
2120 (define-public python-flaky
2121   (package
2122     (name "python-flaky")
2123     (version "3.5.3")
2124     (source (origin
2125               (method url-fetch)
2126               (uri (pypi-uri "flaky" version))
2127               (sha256
2128                (base32
2129                 "1nm1kjf857z5aw7v642ffsy1vwf255c6wjvmil71kckjyd0mxg8j"))))
2130     (build-system python-build-system)
2131     (arguments
2132      ;; TODO: Tests require 'coveralls' and 'genty' which are not in Guix yet.
2133      '(#:tests? #f))
2134     (home-page "https://github.com/box/flaky")
2135     (synopsis "Automatically rerun flaky tests")
2136     (description
2137      "Flaky is a plugin for @code{nose} or @code{py.test} that automatically
2138 reruns flaky tests.
2140 Ideally, tests reliably pass or fail, but sometimes test fixtures must rely
2141 on components that aren't 100% reliable.  With flaky, instead of removing
2142 those tests or marking them to @code{@@skip}, they can be automatically
2143 retried.")
2144     (license license:asl2.0)))
2146 (define-public python2-flaky
2147   (package-with-python2 python-flaky))
2149 (define-public python-pyhamcrest
2150   (package
2151     (name "python-pyhamcrest")
2152     (version "1.9.0")
2153     (source (origin
2154               ;; Tests not distributed from pypi release.
2155               (method git-fetch)
2156               (uri (git-reference
2157                      (url "https://github.com/hamcrest/PyHamcrest")
2158                      (commit (string-append "V" version))))
2159               (file-name (git-file-name name version))
2160               (sha256
2161                (base32
2162                 "01qnzj9qnzz0y78qa3ing24ssvszb0adw59xc4qqmdn5wryy606b"))))
2163     (native-inputs                      ; All native inputs are for tests
2164      `(("python-pytest-cov" ,python-pytest-cov)
2165        ("python-mock" ,python-mock)
2166        ("python-pytest" ,python-pytest)
2167        ("python-hypothesis" ,python-hypothesis)))
2168     (propagated-inputs
2169      `(("python-six" ,python-six)))
2170     (build-system python-build-system)
2171     (home-page "http://hamcrest.org/")
2172     (synopsis "Hamcrest matchers for Python")
2173     (description
2174      "PyHamcrest is a framework for writing matcher objects,
2175  allowing you to declaratively define \"match\" rules.")
2176     (license license:bsd-3)))
2178 (define-public python2-pyhamcrest
2179   (package-with-python2 python-pyhamcrest))
2181 (define-public unittest-cpp
2182   (package
2183     (name "unittest-cpp")
2184     (version "2.0.0")
2185     (source (origin
2186               (method git-fetch)
2187               (uri (git-reference
2188                      (url "https://github.com/unittest-cpp/unittest-cpp")
2189                      (commit (string-append "v" version))))
2190               (file-name (git-file-name name version))
2191               (sha256
2192                (base32 "0sxb3835nly1jxn071f59fwbdzmqi74j040r81fanxyw3s1azw0i"))))
2193     (arguments
2194      `(#:tests? #f))                     ; It's run after build automatically.
2195     (build-system cmake-build-system)
2196     (home-page "https://github.com/unittest-cpp/unittest-cpp")
2197     (synopsis "Lightweight unit testing framework for C++")
2198     (description "UnitTest++ is a lightweight unit testing framework for C++.
2199 It was designed to do test-driven development on a wide variety of platforms.
2200 Simplicity, portability, speed, and small footprint are all very important
2201 aspects of UnitTest++.  UnitTest++ is mostly standard C++ and makes minimal use
2202 of advanced library and language features, which means it should be easily
2203 portable to just about any platform.")
2204     (license license:expat)))
2206 (define-public libfaketime
2207   (package
2208     (name "libfaketime")
2209     (version "0.9.7")
2210     (home-page "https://github.com/wolfcw/libfaketime")
2211     (source (origin
2212               (method git-fetch)
2213               (uri (git-reference
2214                     (url home-page)
2215                     (commit (string-append "v" version))))
2216               (sha256
2217                (base32
2218                 "1cin1pqwpsswcv7amiwijirvcg3x1zf2l00s1x84nxc5602fzr5c"))
2219               (file-name (git-file-name name version))))
2220     (build-system gnu-build-system)
2221     (arguments
2222      '(#:phases (modify-phases %standard-phases
2223                   (replace 'configure
2224                     (lambda* (#:key outputs #:allow-other-keys)
2225                       (let ((out (assoc-ref outputs "out")))
2226                         (setenv "CC" "gcc")
2227                         (setenv "PREFIX" out)
2228                         #t)))
2229                   (add-before 'check 'pre-check
2230                     (lambda _
2231                       (substitute* "test/functests/test_exclude_mono.sh"
2232                         (("/bin/bash") (which "bash")))
2233                       #t)))
2234        #:test-target "test"))
2235     (native-inputs
2236      `(("perl" ,perl)))                           ;for tests
2237     (synopsis "Fake the system time for single applications")
2238     (description
2239      "The libfaketime library allows users to modify the system time that an
2240 application \"sees\".  It is meant to be loaded using the dynamic linker's
2241 @code{LD_PRELOAD} environment variable.  The @command{faketime} command
2242 provides a simple way to achieve this.")
2243     (license license:gpl2)))
2245 (define-public umockdev
2246   (package
2247     (name "umockdev")
2248     (version "0.12.1")
2249     (source (origin
2250               (method url-fetch)
2251               (uri (string-append "https://github.com/martinpitt/umockdev/"
2252                                   "releases/download/" version  "/"
2253                                   "umockdev-" version ".tar.xz"))
2254               (sha256
2255                (base32
2256                 "1hx5jm9afng6hw9wyp524z8nwdp6w053pca0w2c0gqpgrmvjxvd2"))))
2257     (build-system gnu-build-system)
2258     (arguments
2259      `(#:phases
2260        (modify-phases %standard-phases
2261          (add-after 'unpack 'skip-broken-test
2262            (lambda _
2263              (substitute* "tests/test-umockdev.c"
2264                (("/\\* sys/ in other dir")
2265                 (string-append "return; // ")))
2266              #t)))))
2267     (native-inputs
2268      `(("vala" ,vala)
2269        ("python" ,python)               ; for tests
2270        ("which" ,which)                 ; for tests
2271        ("gtk-doc" ,gtk-doc)
2272        ("pkg-config" ,pkg-config)))
2273     (inputs
2274      `(("glib" ,glib)
2275        ("eudev" ,eudev)
2276        ("libgudev" ,libgudev)
2277        ("gobject-introspection" ,gobject-introspection)))
2278     (home-page "https://github.com/martinpitt/umockdev/")
2279     (synopsis "Mock hardware devices for creating unit tests")
2280     (description "umockdev mocks hardware devices for creating integration
2281 tests for hardware related libraries and programs.  It also provides tools to
2282 record the properties and behaviour of particular devices, and to run a
2283 program or test suite under a test bed with the previously recorded devices
2284 loaded.")
2285     (license license:lgpl2.1+)))
2287 (define-public python-pyfakefs
2288   (package
2289     (name "python-pyfakefs")
2290     (version "3.5.8")
2291     (source (origin
2292               (method url-fetch)
2293               ;; We use the PyPI URL because there is no proper release
2294               ;; available from GitHub.  The GitHub project only provides
2295               ;; autogenerated tarballs, which are known to change in place.
2296               (uri (pypi-uri "pyfakefs" version))
2297               (sha256
2298                (base32
2299                 "0qb9jp0bqhc0dv0rn805fv99029fvx135f3bvka6scfkcl6jgllc"))
2300               (patches (search-patches
2301                         "python-pyfakefs-remove-bad-test.patch"))
2302               (file-name (string-append name "-" version ".tar.gz"))))
2303     (arguments
2304      `(#:phases
2305        (modify-phases %standard-phases
2306          ;; The default test suite does not run these extra tests.
2307          (add-after 'check 'check-pytest-plugin
2308            (lambda _
2309              (invoke
2310               "python" "-m" "pytest"
2311               "pyfakefs/pytest_tests/pytest_plugin_test.py")
2312              #t)))))
2313     (native-inputs
2314      `(("python-pytest" ,python-pytest)))
2315     (build-system python-build-system)
2316     ;; Guix lint doesn't like that this is a permanent redirect to the GitHub
2317     ;; page, but the pyfakefs documentation asks us to use this specific URL
2318     ;; when linking to the project.  Honor their request.
2319     (home-page "http://pyfakefs.org/")
2320     ;; TRANSLATORS: In the synopsis, "Mock" is a verb.
2321     (synopsis "Mock file system interactions in tests")
2322     (description
2323      "This package provides a Python library intended for use in automated
2324 tests.  One difficulty when testing software is that the code under test might
2325 need to read or write to files in the local file system.  If the file system
2326 is not set up in just the right way, it might cause a spurious error during
2327 the test.  The pyfakefs library provides a solution to problems like this by
2328 mocking file system interactions.  In other words, it arranges for the code
2329 under test to interact with a fake file system instead of the real file
2330 system.  The code under test requires no modification to work with pyfakefs.")
2331     (license license:asl2.0)))
2333 (define-public python2-pyfakefs
2334   (package-with-python2 python-pyfakefs))