tests: Skip Python tests if the bindings are not built.

* tests/gpgme/wrap.scm (python): Move variable...
* tests/gpgme/gpgme-defs.scm (python): ... here.
(run-python-tests?): New function.
* tests/gpgme/run-tests.scm: Only run Python tests if the bindings can
be located in GPGME's build directory.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-03-14 12:45:29 +01:00
parent 40b7911130
commit d82abbb1b6
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
3 changed files with 13 additions and 4 deletions

View File

@ -171,3 +171,13 @@
(else
(expand-one (append acc (list (car v))) (cdr v))))))
values)))
(define python (catch #f
(path-expand "python" (string-split (getenv "PATH") *pathsep*))))
(define (run-python-tests?)
(let* ((python-version
(string-trim char-whitespace?
(call-popen `(,python -c "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))") "")))
(build-path (path-join gpgme-builddir "lang" "python"
(string-append "python" python-version "-gpg"))))
(trace (file-exists? (trace build-path)))))

View File

@ -71,5 +71,7 @@
-- ,@(:path cmpnts))))
(if (null? tests) (all-tests makefile (:key cmpnts)) tests))))
`((("tests" "gpg") "c_tests" ,setup-c)
(("lang" "python" "tests") "py_tests" ,setup-py)
,@(if (run-python-tests?)
`((("lang" "python" "tests") "py_tests" ,setup-py))
'())
(("lang" "qt" "tests") "TESTS" ,setup-c))))))

View File

@ -29,9 +29,6 @@
(setenv "top_srcdir" gpgme-srcdir #t)
(setenv "srcdir" (path-join gpgme-srcdir "tests" "gpg") #t)
(define python (catch #f
(path-expand "python" (string-split (getenv "PATH") *pathsep*))))
(define (run what)
(if (string-suffix? (car what) ".py")
(begin