Skip to content

Commit

Permalink
Merge pull request #52 from common-workflow-language/install-tests
Browse files Browse the repository at this point in the history
make tests installable and runnable after install
  • Loading branch information
mr-c authored Aug 16, 2016
2 parents 0514920 + ac7341c commit a833808
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include gittaggers.py ez_setup.py
include gittaggers.py ez_setup.py Makefile
include schema_salad/tests/*.py schema_salad/tests/*.yml schema_salad/tests/*.owl
include schema_salad/metaschema/*
global-exclude *.pyc
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MODULE=schema_salad
# `SHELL=bash` Will break Titus's laptop, so don't use BASH-isms like
# `[[` conditional expressions.
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 pytest

VERSION=$(shell git describe --tags --dirty | sed s/v//)

Expand All @@ -46,7 +46,7 @@ install-dependencies:

## install : install the ${MODULE} module and schema-salad-tool
install: FORCE
./setup.py build install
pip install .

## dist : create a module package for distribution
dist: dist/${MODULE}-$(VERSION).tar.gz
Expand Down
59 changes: 59 additions & 0 deletions release-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -e
set -x

package=schema-salad
module=schema_salad
repo=https://github.com/common-workflow-language/schema_salad.git
run_tests="py.test --pyarg ${module}"

rm -Rf testenv? || /bin/true

export HEAD=`git rev-parse HEAD`
virtualenv testenv1
virtualenv testenv2
virtualenv testenv3
virtualenv testenv4

# First we test the head
source testenv1/bin/activate
make install-dependencies
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir testenv1/not-${module}
# if there is a subdir named '${module}' py.test will execute tests
# there instead of the installed module's tests
pushd testenv1/not-${module}; ../bin/${run_tests}; popd


# Secondly we test via pip

cd testenv2
source bin/activate
pip install -U setuptools==3.4.1
pip install -e git+${repo}@${HEAD}#egg=${package}
cd src/${package}
make install-dependencies
make dist
make test
cp dist/${package}*tar.gz ../../../testenv3/
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
cd ../.. # no subdir named ${proj} here, safe for py.testing the installed module
bin/${run_tests}

# Is the distribution in testenv2 complete enough to build another
# functional distribution?

cd ../testenv3/
source bin/activate
pip install -U setuptools==3.4.1
pip install ${package}*tar.gz
pip install pytest
tar xzf ${package}*tar.gz
cd ${package}*
make dist
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir ../not-${module}
pushd ../not-${module} ; ../bin/${run_tests}; popd

0 comments on commit a833808

Please sign in to comment.