|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | +set -x |
| 5 | + |
| 6 | +package=schema-salad |
| 7 | +module=schema_salad |
| 8 | +repo=https://github.com/common-workflow-language/schema_salad.git |
| 9 | +run_tests="py.test --pyarg ${module}" |
| 10 | + |
| 11 | +rm -Rf testenv? || /bin/true |
| 12 | + |
| 13 | +export HEAD=`git rev-parse HEAD` |
| 14 | +virtualenv testenv1 |
| 15 | +virtualenv testenv2 |
| 16 | +virtualenv testenv3 |
| 17 | +virtualenv testenv4 |
| 18 | + |
| 19 | +# First we test the head |
| 20 | +source testenv1/bin/activate |
| 21 | +make install-dependencies |
| 22 | +make test |
| 23 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 24 | +mkdir testenv1/not-${module} |
| 25 | +# if there is a subdir named '${module}' py.test will execute tests |
| 26 | +# there instead of the installed module's tests |
| 27 | +pushd testenv1/not-${module}; ../bin/${run_tests}; popd |
| 28 | + |
| 29 | + |
| 30 | +# Secondly we test via pip |
| 31 | + |
| 32 | +cd testenv2 |
| 33 | +source bin/activate |
| 34 | +pip install -U setuptools==3.4.1 |
| 35 | +pip install -e git+${repo}@${HEAD}#egg=${package} |
| 36 | +cd src/${package} |
| 37 | +make install-dependencies |
| 38 | +make dist |
| 39 | +make test |
| 40 | +cp dist/${package}*tar.gz ../../../testenv3/ |
| 41 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 42 | +cd ../.. # no subdir named ${proj} here, safe for py.testing the installed module |
| 43 | +bin/${run_tests} |
| 44 | + |
| 45 | +# Is the distribution in testenv2 complete enough to build another |
| 46 | +# functional distribution? |
| 47 | + |
| 48 | +cd ../testenv3/ |
| 49 | +source bin/activate |
| 50 | +pip install -U setuptools==3.4.1 |
| 51 | +pip install ${package}*tar.gz |
| 52 | +pip install pytest |
| 53 | +tar xzf ${package}*tar.gz |
| 54 | +cd ${package}* |
| 55 | +make dist |
| 56 | +make test |
| 57 | +pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install |
| 58 | +mkdir ../not-${module} |
| 59 | +pushd ../not-${module} ; ../bin/${run_tests}; popd |
0 commit comments