Skip to content

Commit 5890eb2

Browse files
committed
make tests installable and runnable after install
1 parent 0514920 commit 5890eb2

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

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

0 commit comments

Comments
 (0)