1- #! /bin/sh
1+ #! /bin/bash
2+
23# Run the Snowplow Tracker test suite.
34
45# Quit on failure
@@ -9,9 +10,81 @@ cd $(dirname $0)
910
1011# pytest because it has a neat output
1112
12- # Test against Python 3
13- ~ /snowplow-python-3.3-tracker-environment/bin/python3.3 -m pytest -s
13+ export PATH=" ~/.pyenv/bin:$PATH "
14+ eval " $( pyenv init -) "
15+ eval " $( pyenv virtualenv-init -) "
16+
17+ function deploy {
18+
19+ # pyenv install 2.7.12
20+ if [ ! -f ~ /.pyenv/versions/tracker27 ]; then
21+ pyenv virtualenv 2.7.12 tracker27
22+ pyenv activate tracker27
23+ pip install -r requirements.txt
24+ pip install -r requirements-test.txt
25+ source deactivate
26+ fi
27+
28+ # pyenv install 3.3.6
29+ if [ ! -f ~ /.pyenv/versions/tracker33 ]; then
30+ pyenv virtualenv 3.3.6 tracker33
31+ pyenv activate tracker33
32+ pip install -r requirements.txt
33+ pip install -r requirements-test.txt
34+ source deactivate
35+ fi
36+
37+ # pyenv install 3.4.5
38+ if [ ! -f ~ /.pyenv/versions/tracker34 ]; then
39+ pyenv virtualenv 3.4.5 tracker34
40+ pyenv activate tracker34
41+ pip install -r requirements.txt
42+ pip install -r requirements-test.txt
43+ source deactivate
44+ fi
45+
46+ # pyenv install 3.5.2
47+ if [ ! -f ~ /.pyenv/versions/tracker35 ]; then
48+ pyenv virtualenv 3.5.2 tracker35
49+ pyenv activate tracker35
50+ pip install -r requirements.txt
51+ pip install -r requirements-test.txt
52+ source deactivate
53+ fi
54+
55+ }
56+
57+
58+ function run_tests {
59+
60+ pyenv activate tracker27
61+ pytest -s
62+ source deactivate
63+
64+ pyenv activate tracker33
65+ pytest
66+ source deactivate
67+
68+ pyenv activate tracker34
69+ pytest
70+ source deactivate
71+
72+ pyenv activate tracker35
73+ pytest
74+ source deactivate
75+ }
76+
77+
78+ case " $1 " in
1479
15- # Test against Python 2
16- ~ /snowplow-python-2.7-tracker-environment/bin/python2.7 -m pytest -s
80+ " deploy" ) echo " Deploying python environments. This can take few minutes"
81+ deploy
82+ ;;
83+ " test" ) echo " Running tests"
84+ run_tests
85+ ;;
86+ * ) echo " Unknown subcommand. Specify deploy or test"
87+ exit 1
88+ ;;
1789
90+ esac
0 commit comments