#!/bin/sh
set -e

if [ `id -u` = 0 ]; then
  echo "Blob tests fail when run with root user."
  exit 1
fi

PYVERS=$(pyversions -vr debian/control)

for version in ${PYVERS}; do
    echo Running tests for python${version}
    python${version} <<EOF
from zope import testrunner
from distutils import sysconfig

test_path = sysconfig.get_python_lib()

exitcode = testrunner.run([
                '-k',
                '-m', '(BTrees|ZEO|ZODB)',
                '--test-path', test_path
                ])
sys.exit(exitcode)
EOF

done
