Skip to content

Commit 7fea190

Browse files
committed
Add Tox support for automating tests across multiple Python versions and for gathering coverage statistics. Include brief instructions in README.
1 parent 628c450 commit 7fea190

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33

44
local*.cfg
55

6+
.coverage
7+
.tox/
68
build/
9+
htmlcov/
710
python_bitcoinlib.egg-info/

README

+16
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ Under bitcoin/tests using test data from Bitcoin Core. To run them:
111111

112112
Please run the tests on both Python2 and Python3 for your pull-reqs!
113113

114+
Alternately, if Tox (see https://tox.readthedocs.org/) is available on your
115+
system, you can run unit tests for multiple Python versions:
116+
117+
./runtests.sh
118+
119+
Currently, the following implementations are tried (any not installed are
120+
skipped):
121+
122+
* CPython 2.7
123+
* CPython 3.3
124+
* CPython 3.4
125+
* CPython 3.5
126+
* PyPy
127+
* PyPy3
128+
129+
HTML coverage reports can then be found in the htmlcov/ subdirectory.
114130

115131
Documentation
116132
-------------

runtests.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env sh
2+
#-*-mode: sh; encoding: utf-8-*-
3+
4+
_MY_DIR="$( cd "$( dirname "${0}" )" && pwd )"
5+
set -ex
6+
[ -d "${_MY_DIR}" ]
7+
[ "${_MY_DIR}/runtests.sh" -ef "${0}" ]
8+
cd "${_MY_DIR}"
9+
exec tox ${1+"${@}"}

tox.ini

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#-*-mode: ini; encoding: utf-8-*-
2+
3+
[tox] #-------------------------------------------------------------------
4+
5+
envlist = reset,py27,py33,py34,py35,pypy,pypy3,stats
6+
skip_missing_interpreters = True
7+
8+
[testenv] #---------------------------------------------------------------
9+
10+
commands =
11+
coverage run --append --omit='tests/*,*/site-packages/*,*/distutils/*,*/lib_pypy/*' setup.py test -q
12+
13+
deps =
14+
coverage
15+
16+
setenv =
17+
PYTHONWARNINGS = all
18+
19+
[testenv:reset] #---------------------------------------------------------
20+
21+
commands =
22+
coverage erase
23+
24+
[testenv:stats] #---------------------------------------------------------
25+
26+
commands =
27+
coverage report
28+
coverage html

0 commit comments

Comments
 (0)