Skip to content

Commit a833808

Browse files
authored
Merge pull request #52 from common-workflow-language/install-tests
make tests installable and runnable after install
2 parents 0514920 + ac7341c commit a833808

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
include gittaggers.py ez_setup.py
1+
include gittaggers.py ez_setup.py Makefile
22
include schema_salad/tests/*.py schema_salad/tests/*.yml schema_salad/tests/*.owl
3+
include schema_salad/metaschema/*
34
global-exclude *.pyc

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MODULE=schema_salad
2626
# `SHELL=bash` Will break Titus's laptop, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29-
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257
29+
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 pytest
3030

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

@@ -46,7 +46,7 @@ install-dependencies:
4646

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

5151
## dist : create a module package for distribution
5252
dist: dist/${MODULE}-$(VERSION).tar.gz

release-test.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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

Comments
 (0)