summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2015-10-27 19:12:33 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2015-10-27 20:31:18 -0400
commit1e315d7adaec7b22ec68c8a643277e27317ba11f (patch)
tree2c627324cae9126d3799fd0e7afabf14ce1a141a
parentc03ab241e7336f0c6c8110a1f3216c85bfaf851c (diff)
downloadpycurl-1e315d7adaec7b22ec68c8a643277e27317ba11f.tar.gz
Run examples in CI
-rw-r--r--Makefile3
-rwxr-xr-xtests/run-quickstart.sh31
-rwxr-xr-xtests/travis/run.sh1
3 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 396c477..a3e95ba 100644
--- a/Makefile
+++ b/Makefile
@@ -127,6 +127,9 @@ maintainer-clean: distclean
dist sdist: distclean
$(PYTHON) setup.py sdist
+run-quickstart:
+ ./tests/run-quickstart.sh
+
# Rebuild missing or changed documentation.
# Editing docstrings in Python or C source will not cause the documentation
# to be rebuilt with this target, use docs-force instead.
diff --git a/tests/run-quickstart.sh b/tests/run-quickstart.sh
new file mode 100755
index 0000000..4118df7
--- /dev/null
+++ b/tests/run-quickstart.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+set -e
+
+export PYTHONSUFFIX=$(python -V 2>&1 |awk '{print $2}' |awk -F. '{print $1 "." $2}')
+export PYTHONPATH="`pwd`"/$(ls -d build/lib.*$PYTHONSUFFIX):$PYTHONPATH
+
+tmpdir=`mktemp -d`
+
+finish() {
+ rm -rf "$tmpdir"
+}
+
+trap finish EXIT
+
+for file in "`pwd`"/examples/quickstart/*.py; do \
+ set +e
+ (cd "$tmpdir" && python "$file" >output)
+ rv=$?
+ set -e
+ if test "$rv" != 0; then
+ echo "$file failed, standard error contents (if any) is above"
+ if test -n "`cat output`"; then
+ echo "Standard output contents:"
+ cat "$tmpdir"/output
+ fi
+ exit $rv
+ fi
+done
+
+echo 'All ok'
diff --git a/tests/travis/run.sh b/tests/travis/run.sh
index 5933d59..98dd1af 100755
--- a/tests/travis/run.sh
+++ b/tests/travis/run.sh
@@ -57,6 +57,7 @@ python setup.py build $setup_args
./tests/ext/test-suite.sh
which pyflakes
pyflakes python examples tests setup.py winbuild.py
+./tests/run-quickstart.sh
# sphinx requires python 2.6+ or 3.3+
case "$USEPY" in