Use tox for running tests and building docs

* Set up tox for testing supported Django/Python combinations
* Also include tox env for checking and building docs
* Use tox-travis for Travis CI integration
* Add tests against Django master
* Document building docs and running tests with tox
This commit is contained in:
medmunds
2018-03-12 11:56:08 -07:00
committed by Mike Edmunds
parent b32c3ccb38
commit b06d684dd5
8 changed files with 489 additions and 61 deletions

102
tox.ini Normal file
View File

@@ -0,0 +1,102 @@
[tox]
envlist =
# Test these environments first, to catch most errors early...
lint
django20-py36
django18-py27
docs
# ... then test all the other supported combinations:
django20-py{35,py3}
django111-py{27,34,35,36,py2}
django110-py{27,34,35,py2}
django19-py{27,34,35,py2}
django18-py{33,34,35,py2}
# ... then prereleases (if available):
#django21-py{35,36}
djangoMaster-py{36,37}
[testenv]
deps =
django18: django>=1.8,<1.9
django19: django>=1.9,<1.10
django110: django>=1.10,<1.11
django111: django>=1.11,<1.12
django20: django>=2.0,<2.1
django21: django>=2.1a1
djangoMaster: https://github.com/django/django/tarball/master
# testing dependencies (duplicates setup.py tests_require):
mock
sparkpost
ignore_outcome =
django21: True
djangoMaster: True
usedevelop = True
args_are_paths = False
commands =
python --version
# pip install .[mailgun,...,sparkpost] ## usedevelop=True + manual deps is much faster on repeat runs
python runtests.py {posargs}
passenv =
RUN_LIVE_TESTS
CONTINUOUS_INTEGRATION
MAILGUN_TEST_*
MAILJET_TEST_*
MANDRILL_TEST_*
POSTMARK_TEST_*
SENDINBLUE_TEST_*
SENDGRID_TEST_*
SPARKPOST_TEST_*
[testenv:lint]
basepython = python3
skip_install = True
passenv =
CONTINUOUS_INTEGRATION
# (but not any of the live test API keys)
deps =
flake8
commands =
python --version
flake8 --version
flake8
[testenv:docs]
basepython = python3
skip_install = True
passenv =
CONTINUOUS_INTEGRATION
# (but not any of the live test API keys)
setenv =
DOCS_BUILD_DIR={envdir}/_html
whitelist_externals = /bin/bash
deps =
sphinx
sphinx-rtd-theme
commands =
# Verify README.rst as used in setup.py long_description:
python setup.py check --restructuredtext --strict
# Build and verify docs:
sphinx-build -W -b dirhtml docs {env:DOCS_BUILD_DIR}
# Build README.rst into html:
/bin/bash -c 'python setup.py --long-description \
| rst2html.py --config=docs/_readme/docutils.cfg \
> {env:DOCS_BUILD_DIR}/readme.html'
[travis]
unignore_outcomes = True
python =
3.6: py36, lint, docs
[travis:env]
DJANGO =
1.8: django18
1.9: django19
1.10: django110
1.11: django111
2.0: django20
2.1: django21
master: djangoMaster
LINT_AND_DOCS =
true: lint, docs
docs: docs
lint: lint