Switch to using tox for testing

This allows easier testing of multiple versions of Python in a more
automated fashion. This is needed if we're ever going to make some
of the planned extensive refactorings.

This change:

* adds tox.ini
* updates Makefile and .travis.yml to point to tox
* fixes a doctest typo found while make sure the Makefile targets
  work
* adds a [docs] extras_require so that the deps in tox are managed
  cleanly

The pep8 target is currently commented out because it fails (and
has done for a long time). Will fix asap. This commit is to ensure
that travis is working. Followups will tune it up.
This commit is contained in:
Chris Dent 2016-09-22 18:54:32 +01:00
parent 28f93239cd
commit 57d6a28b26
5 changed files with 49 additions and 11 deletions

View File

@ -1,11 +1,20 @@
sudo: false
language: python
python:
- 2.7
- 3.3
- 3.4
- 3.5
script: make test
- "3.5"
install:
- pip install \
`python -c 'from setup import META; print(" ".join(META["extras_require"]["testing"]))'`
- pip install tox
script:
- tox
env:
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
- TOXENV=pypy
# XXX: known to fail, fixes to follow
#- TOXENV=pep8
- TOXENV=docs
notifications:
irc: "chat.freenode.net#gabbi"

View File

@ -24,7 +24,7 @@ reclean:
cd docs && make clean
test:
py.test --tb=short -x test
tox --skip-missing-interpreters
doctest:
cd docs && make doctest
@ -39,6 +39,6 @@ pypi:
python setup.py sdist upload
docs:
cd docs && $(MAKE) html
tox -edocs
release: clean test tagv reclean pypi

View File

@ -27,6 +27,6 @@ Example:
url = 'http://{0}:{1}/'.format(host, port)
urllib3_intercept.install()
add_wsgi_intercept(host, port, make_app)
resp = pool.requests('GET', url)
resp = pool.request('GET', url)
assert resp.data == b'Whee'
urllib3_intercept.uninstall()

View File

@ -40,6 +40,9 @@ META = {
'requests>=2.0.1',
'urllib3>=1.11.0',
],
'docs': [
'sphinx',
],
},
}

26
tox.ini Normal file
View File

@ -0,0 +1,26 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py27,py33,py34,py35,pypy,pep8,docs
[testenv]
deps = .[testing]
usedevelop = True
commands = py.test test
passenv = WSGI_INTERCEPT_*
[testenv:pep8]
deps = flake8
commands =
flake8
[testenv:docs]
deps = .[docs]
commands =
python setup.py build_sphinx
whitelist_externals =
rm
[flake8]
exclude=.venv,.git,.tox,dist,*egg,*.egg-info,build,examples,docs
show-source = True