aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2016-12-29 00:09:40 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-01-18 21:28:59 +0100
commitdf893a385571cb8479cd0d5a7c6354f55b14d1b0 (patch)
tree3c5ae019d1c9985f7884f7ee49ee22d7f6f6659d /gnu/packages
parentb9f771a795c46cb9fa22b2085c2d566ff21dd534 (diff)
downloadguix-df893a385571cb8479cd0d5a7c6354f55b14d1b0.tar
guix-df893a385571cb8479cd0d5a7c6354f55b14d1b0.tar.gz
gnu: Add python-cram.
* gnu/packages/python.scm (python-cram, python2-cram): New variables.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/python.scm61
1 files changed, 60 insertions, 1 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index a9792afe25..6a5b0c4f18 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -26,7 +26,7 @@
;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
-;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2016 Stefan Reichoer <stefan@xsteve.at>
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
;;; Copyright © 2016 Alex Vong <alexvong1995@gmail.com>
@@ -6085,6 +6085,65 @@ pseudo terminal (pty), and interact with both the process and its pty.")
(define-public python2-ptyprocess
(package-with-python2 python-ptyprocess))
+(define-public python-cram
+ (package
+ (name "python-cram")
+ (version "0.7")
+ (home-page "https://bitheap.org/cram/")
+ (source (origin
+ (method url-fetch)
+ (uri (list (string-append home-page "cram-"
+ version ".tar.gz")
+ (pypi-uri "cram" version)))
+ (sha256
+ (base32
+ "0bvz6fwdi55rkrz3f50zsy35gvvwhlppki2yml5bj5ffy9d499vx"))))
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda _
+ (substitute* (find-files "cram" ".*\\.py$")
+ ;; Replace default shell path.
+ (("/bin/sh") (which "sh")))
+ (substitute* (find-files "tests" ".*\\.t$")
+ (("md5") "md5sum")
+ (("/bin/bash") (which "bash"))
+ (("/bin/sh") (which "sh")))
+ (substitute* "cram/_test.py"
+ ;; This hack works around a bug triggered by substituting
+ ;; the /bin/sh paths. "tests/usage.t" compares the output of
+ ;; "cram -h", which breaks the output at 80 characters. This
+ ;; causes the line showing the default shell to break into two
+ ;; lines, but the test expects a single line...
+ (("env\\['COLUMNS'\\] = '80'")
+ "env['COLUMNS'] = '160'"))
+ #t))
+ (delete 'check)
+ (add-after 'install 'check
+ ;; The test phase uses the built library and executable.
+ ;; It's easier to run it after install since the build
+ ;; directory contains version-specific PATH.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (add-installed-pythonpath inputs outputs)
+ (setenv "PATH" (string-append (getenv "PATH") ":"
+ (assoc-ref outputs "out") "/bin"))
+ (zero? (system* "make" "test")))))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("python-coverage" ,python-coverage)
+ ("which" ,which)))
+ (synopsis "Simple testing framework for command line applications")
+ (description
+ "Cram is a functional testing framework for command line applications.
+Cram tests look like snippets of interactive shell sessions. Cram runs each
+command and compares the command output in the test with the command’s actual
+output.")
+ (license license:gpl2+)))
+
+(define-public python2-cram
+ (package-with-python2 python-cram))
+
(define-public python-terminado
(package
(name "python-terminado")