Skip to content

Commit 44321bf

Browse files
committed
check coverage using Codecov.io
1 parent ea99c55 commit 44321bf

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist
33
tags
44
*.egg-info
55
Dockerfile
6+
.coverage

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ services:
66
- docker
77

88
install:
9-
- sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
9+
- sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
1010
- docker-compose build
1111

1212
script:
13-
- docker-compose run tests
13+
- docker-compose run $(bash <(curl -s https://codecov.io/env)) tests
1414

1515
notifications:
1616
email:

Dockerfile.tmpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ FROM postgres:${PG_VERSION}-alpine
22

33
ENV PYTHON=python${PYTHON_VERSION}
44
RUN if [ "${PYTHON_VERSION}" = "2" ] ; then \
5-
apk add --no-cache python py-pip; \
6-
pip install six pg8000 flake8 port-for; \
5+
apk add --no-cache python2 py-virtualenv py-pip; \
76
fi
87
RUN if [ "${PYTHON_VERSION}" = "3" ] ; then \
9-
apk add --no-cache python3; \
10-
pip3 install six pg8000 flake8 port-for; \
8+
apk add --no-cache python3 py-virtualenv; \
119
fi
1210
ENV LANG=C.UTF-8
1311

@@ -18,7 +16,6 @@ RUN chmod 755 /run.sh
1816

1917
ADD . /pg/testgres
2018
WORKDIR /pg/testgres
21-
RUN ${PYTHON} setup.py install
2219

2320
USER postgres
2421
ENTRYPOINT PYTHON=${PYTHON} /run.sh

run_tests.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,33 @@
22

33
set -eux
44

5-
cd testgres/tests
6-
${PYTHON} -m unittest test_simple
5+
if [ "$PYTHON_VERSION" -eq "2" ]; then
6+
virtualenv="virtualenv --python=/usr/bin/python2"
7+
pip=pip2
8+
else
9+
virtualenv="virtualenv --python=/usr/bin/python3"
10+
pip=pip3
11+
fi
12+
13+
# prepare environment
14+
$virtualenv env
15+
source env/bin/activate
16+
17+
# install utilities
18+
$pip install coverage codecov flake8
19+
20+
# install testgres
21+
$pip install -U .
722

8-
cd ../..
23+
# test code quality
924
flake8 .
1025

11-
cd ../..
26+
# run tests
27+
cd testgres/tests
28+
coverage run test_simple.py
29+
30+
# show coverage
31+
coverage report
32+
33+
# gather reports
34+
codecov

0 commit comments

Comments
 (0)