summaryrefslogtreecommitdiffstats
path: root/__root__
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2016-01-04 20:42:00 +0100
committerJan Pokorný <jpokorny@redhat.com>2016-02-01 23:53:19 +0100
commitbb508111a25ca4cafdab7338f38a5374c67a11c4 (patch)
treeac8e91cda381cc9085c671456f90f40e94d822bb /__root__
parent6e37a0dc29c221354a7d52ba9b134a1ee0cadf2b (diff)
downloadclufter-bb508111a25ca4cafdab7338f38a5374c67a11c4.tar.gz
clufter-bb508111a25ca4cafdab7338f38a5374c67a11c4.tar.xz
clufter-bb508111a25ca4cafdab7338f38a5374c67a11c4.zip
run-tests: fix nonshort short-circuiting + Py2.6 -m pkg.__main__
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to '__root__')
-rwxr-xr-x__root__/run-tests13
1 files changed, 9 insertions, 4 deletions
diff --git a/__root__/run-tests b/__root__/run-tests
index 442d161..adba625 100755
--- a/__root__/run-tests
+++ b/__root__/run-tests
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright 2015 Red Hat, Inc.
+# Copyright 2016 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
@@ -29,9 +29,12 @@ TAIL='2>&1 | sed \
if ${PYTHONEXEC} -c "import sys; sys.exit(sys.version_info[:2] < (2,7))"; then
CMD="-m unittest"
-else
+elif ${PYTHONEXEC} -c "import sys; sys.exit(sys.version_info[:2] < (2,6))"; then
# pre-2.7 unittest doesn't offer test discovery, use external unittest2
- CMD="-m unittest2"
+ CMD="-m unittest2.__main__" # see http://bugs.python.org/issue2751
+else
+ die "Unsupported Python version: $(
+ ${PYTHONEXEC} -c "import sys; sys.write(sys.version_info[:2])")"
fi
DEBUG="env LOGLEVEL=WARNING"
PGR=${PAGER:-less}
@@ -94,9 +97,11 @@ eval "${CMDTEST} -h >/dev/null 2>/dev/null"
[ "${COVERAGE}" -eq 0 ] || {
[ "${CMD}" = "nosetests" ] \
&& CMD="${CMD} --with-coverage" \
- || which coverage2 >/dev/null 2>/dev/null \
+ || {
+ which coverage2 >/dev/null 2>/dev/null \
&& CMD="coverage2 run ${CMD}" \
|| CMD="coverage run ${CMD}"
+ }
}
case "${CMD}" in -m*) CMD="${PYTHONEXEC} ${CMD}";;