aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2013-09-11 16:22:22 +0200
committerAndré Erdmann <dywi@mailerd.de>2013-09-11 16:22:22 +0200
commitd9be1d1fd540e7fa04f1de6b47b0394410a69b2e (patch)
tree835e2eacaf2fff3b2a5ab4d24ceacc8f3616356d /bin
parentmove debug-scripts/, roverlay.py to bin/ (diff)
downloadR_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.tar.gz
R_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.tar.bz2
R_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.zip
move run_tests to bin/
Diffstat (limited to 'bin')
-rwxr-xr-xbin/invoke_pyscript_multi.bash35
-rwxr-xr-xbin/py/run_tests.py10
l---------bin/run_tests1
3 files changed, 46 insertions, 0 deletions
diff --git a/bin/invoke_pyscript_multi.bash b/bin/invoke_pyscript_multi.bash
new file mode 100755
index 0000000..73711cd
--- /dev/null
+++ b/bin/invoke_pyscript_multi.bash
@@ -0,0 +1,35 @@
+#!/bin/bash
+# similar to invoke_pyscript.bash, but runs the python script once for
+# each python implementation (PYTHON_IMPL).
+#
+# Also contains some script-specific code,
+# e.g. creates a R-overlay.conf.tests file.
+#
+
+: ${PYTHON_IMPL:="python2.7 python3"}
+
+readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}")
+readonly SCRIPT_NAME="${BASH_SOURCE[0]##*/}"
+readonly SCRIPT_DIR="${SCRIPT%/*}"
+
+readonly PRJROOT="${SCRIPT_DIR%/*}"
+readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py"
+
+readonly CONFIG_FILE="${PRJROOT}/R-overlay.conf"
+
+export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}"
+
+
+cd "${PRJROOT}" || exit
+
+
+[[ -e "${CONFIG_FILE}.tests" ]] || ln -vs -- "${CONFIG_FILE}"{,.tests} || exit 2
+
+for _py in ${PYTHON_IMPL}; do
+ if which "${_py}" 1>/dev/null 2>/dev/null; then
+ echo "Running ${PYSCRIPT##*/} with PYTHON=${_py}"
+ "${_py}" "${PYSCRIPT}" || exit
+ else
+ echo "PYTHON=${_py} not found." 1>&2
+ fi
+done
diff --git a/bin/py/run_tests.py b/bin/py/run_tests.py
new file mode 100755
index 0000000..b3156f1
--- /dev/null
+++ b/bin/py/run_tests.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+import unittest
+
+import tests.depres
+
+
+if __name__ == '__main__':
+ tests = tests.depres.suite()
+ unittest.TextTestRunner ( verbosity=2 ).run ( tests )
diff --git a/bin/run_tests b/bin/run_tests
new file mode 120000
index 0000000..c67414a
--- /dev/null
+++ b/bin/run_tests
@@ -0,0 +1 @@
+invoke_pyscript_multi.bash \ No newline at end of file