test: Use 3.6 instead of 3.5 and remove xdist since it is buggy with py3 (#1069)

This commit is contained in:
Kurt Griffiths 2017-06-15 00:02:33 -06:00 committed by GitHub
parent 3495344ff4
commit 975565ba53
5 changed files with 34 additions and 20 deletions

View File

@ -58,8 +58,8 @@ matrix:
env: TOXENV=py36_smoke_cython
- python: 2.7
env: TOXENV=docs
- python: 3.5
env: TOXENV=py35_hug
- python: 3.6
env: TOXENV=hug
script: tools/travis/run_tests.sh
notifications:

View File

@ -27,10 +27,10 @@ Per our [Code of Conduct][coc], we expect everyone who participates in community
Before submitting a pull request, please ensure you have added or updated tests as appropriate, and that all existing tests still pass with your changes on both Python 2 and Python 3. Please also ensure that your coding style follows PEP 8.
You can check all this by running the following from within the falcon project directory (requires Python 2.7 and Python 3.5 to be installed on your system):
You can check all this by running the following from within the Falcon project directory (requires Python 2.7 and Python 3.6 to be installed on your system):
```bash
$ tox -e py27,py35,pep8
$ tox -e py27,py36,pep8
```
You may also use Python 3.3 or 3.4 if you don't have 3.5 installed on your system. This is just a quick sanity check to verify that your patch works across both Python 2 and Python 3.
@ -63,12 +63,25 @@ $ ~/jython/bin/pytest tests
Pull requests must maintain 100% test coverage of all code branches. This helps ensure the quality of the Falcon framework. To check coverage before submitting a pull request:
```bash
$ tox -e py26,py27,py35 && tools/testing/combine_coverage.sh
$ tools/mintest.sh
```
It is necessary to combine test coverage from all three of these environments in order to account for branches in the code that are only taken for a given Python version.
It is necessary to combine test coverage from multiple environments in order to account for branches in the code that are only taken for a given Python version.
The `combine_coverage.sh` script generates an HTML coverage report that can be viewed by simply opening `.coverage_html/index.html` in a browser. This can be helpful in tracking down specific lines or branches that are missing coverage.
The script generates an HTML coverage report that can be viewed by simply opening `.coverage_html/index.html` in a browser. This can be helpful in tracking down specific lines or branches that are missing coverage.
### Debugging
We use pytest to run all of our tests. Pytest supports pdb and will break as expected on any
`pdb.set_trace()` calls. If you would like to use pdb++ instead of the standard Python
debugger, run one of the following tox environments:
```bash
$ tox -e py2_debug
$ tox -e py3_debug
```
If you wish, you can customize Falcon's `tox.ini` to install alternative debuggers, such as ipdb or pudb.
### Documentation

View File

@ -1,7 +1,6 @@
coverage>=4.1
pytest>=3.0.1
pytest-cov
pytest-xdist
pyyaml
requests
six

3
tools/mintest.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
tox -e py26,py27,py36,pep8 && tools/testing/combine_coverage.sh

23
tox.ini
View File

@ -1,15 +1,14 @@
[tox]
# NOTE(kgriffs): The py26, py27, and py35 envs are required when
# NOTE(kgriffs): The py26, py27, and py36 envs are required when
# checking combined coverage. To check coverage:
#
# $ tox -e py26,py27,py35 && tools/testing/combine_coverage.sh
# $ tox -e py26,py27,py36 && tools/testing/combine_coverage.sh
#
# You can then drill down into coverage details by opening the HTML
# report at ".coverage_html/index.html".
envlist = py26,
py27,
py35,
py36,
pep8,
docs
@ -27,7 +26,7 @@ commands = {toxinidir}/tools/clean.sh {toxinidir}/falcon
whitelist_externals = mkdir
mv
commands = {toxinidir}/tools/clean.sh {toxinidir}/falcon
pytest -n 4 --cov=falcon tests []
pytest --cov=falcon tests []
mkdir -p .coverage_data
mv {toxinidir}/.coverage {toxinidir}/.coverage_data/.coverage.{envname}
@ -42,7 +41,7 @@ deps = {[testenv]deps}
whitelist_externals = {[with-coverage]whitelist_externals}
commands = {[with-coverage]commands}
[testenv:py35]
[testenv:py36]
deps = {[testenv]deps}
pytest-randomly
whitelist_externals = {[with-coverage]whitelist_externals}
@ -56,13 +55,13 @@ commands = {[with-coverage]commands}
deps = -r{toxinidir}/requirements/tests
pdbpp
[testenv:py27_debug]
[testenv:py2_debug]
basepython = python2.7
deps = {[with-debug-tools]deps}
funcsigs
[testenv:py35_debug]
basepython = python3.5
[testenv:py3_debug]
basepython = python3.6
deps = {[with-debug-tools]deps}
# --------------------------------------------------------------------
@ -206,8 +205,8 @@ commands = gunicorn: gunicorn -b localhost:8000 tests.dump_wsgi
basepython = python2.7
commands = python tests/dump_wsgi.py
[testenv:py35_dump_wsgiref]
basepython = python3.5
[testenv:py36_dump_wsgiref]
basepython = python3.6
commands = python tests/dump_wsgi.py
# --------------------------------------------------------------------
@ -299,8 +298,8 @@ commands =
# Ecosystem
# --------------------------------------------------------------------
[testenv:py35_hug]
basepython = python3.5
[testenv:hug]
basepython = python3.6
deps = virtualenv
commands =
{toxinidir}/tools/testing/install_hug.sh