Skip to content

Commit 043d2de

Browse files
committed
Use exact dependencies versions and remove requirements.txt (close snowplow#175)
1 parent 57c525b commit 043d2de

7 files changed

Lines changed: 98 additions & 25 deletions

File tree

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ python:
1010
- "3.5"
1111
# command to install dependencies
1212
install:
13-
- "pip install httmock"
14-
- "pip install freezegun"
15-
- "pip install coveralls"
16-
- "pip install ."
17-
- "python setup.py install"
13+
- "pip install -r requirements-test.txt"
14+
- "pip install -e ."
1815
# command to run tests
1916
script:
20-
nosetests --with-coverage --cover-package=snowplow_tracker
17+
pytest --cov=snowplow_tracker
2118
after_success:
2219
coveralls

requirements-test.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pytest==3.0.2
2+
httmock==1.2.5
3+
freezegun==0.3.7
4+
pytest-cov==2.3.1
5+
coveralls==1.1
6+

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

run-tests.sh

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

setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@
7474
"Operating System :: OS Independent",
7575
],
7676

77-
install_requires = [
78-
"requests",
79-
"pycontracts",
80-
"celery",
81-
"gevent",
82-
"redis",
83-
"six"
77+
install_requires=[
78+
"greenlet==0.4.10",
79+
"requests==2.2.1",
80+
"pycontracts==1.7.6",
81+
"celery==3.1.11",
82+
"gevent==1.0.2",
83+
"redis==2.9.1",
84+
"six==1.9.0"
8485
],
8586
)

vagrant/up.guidance

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
To get started:
22
vagrant ssh
33
cd /vagrant
4-
./run-tests.sh
4+
./run-tests.sh deploy
5+
./run-tests.sh test

vagrant/up.playbooks

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
oss-playbooks/python-pyenv.yml
12
oss-playbooks/snowplow-python-tracker.yml

0 commit comments

Comments
 (0)