Use Tox to run the tests on Travis

Rather than repeating the steps in the Travis config, use Travis to run
tox. This has the added benifit of verifying the setup.py install into a
virtualenv.
This commit is contained in:
Dougal Matthews
2014-08-20 20:11:32 +01:00
parent 56de70a4b1
commit ac4a900e5e
6 changed files with 37 additions and 30 deletions

10
.travis.sh Executable file
View File

@@ -0,0 +1,10 @@
#! /usr/bin/env bash
set -xe
if [ $TOX_ENV == "coverage" ]
then
pip install coveralls
tox -e py27
coveralls
else
tox -e $TOX_ENV
fi

View File

@@ -1,19 +1,16 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
python: "2.7"
env:
- TOX_ENV=py26
- TOX_ENV=py27
- TOX_ENV=py33
- TOX_ENV=py34
- TOX_ENV=flake8
- TOX_ENV=docs
- TOX_ENV=coverage
install:
- pip install -r requirements.txt
- pip install coverage==3.6
- pip install python-coveralls==2.4.0
- export PYTHONPATH=.
before_script: coverage erase
script: ./runtests
after_success: coverage report; coveralls
- pip install tox
script: "./.travis.sh"
matrix:
allow_failures:
- env: TOXENV=coverage

View File

@@ -2,6 +2,4 @@ Jinja2==2.7.1
Markdown==2.3.1
PyYAML==3.10
watchdog==0.7.0
coverage==3.7.1
flake8==2.1.0
ghp-import==0.4.1

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
coverage run --source=mkdocs mkdocs/test.py $@
flake8 mkdocs --ignore=E128,E501 --exclude=__init__.py,compat.py
echo
coverage report

3
test-requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
coverage
flake8
nose

13
tox.ini
View File

@@ -1,9 +1,16 @@
[tox]
envlist = py26,py27,py33,py34,docs
envlist = py26,py27,py33,py34,docs,flake8
[testenv]
deps=-rrequirements.txt
commands=./runtests
deps=
-rrequirements.txt
-rtest-requirements.txt
commands=
{envbindir}/nosetests --with-coverage --cover-package mkdocs --cover-html --cover-html-dir {envtmpdir}/coverage mkdocs/test.py
[testenv:docs]
commands={envbindir}/mkdocs build
[testenv:flake8]
deps=-rtest-requirements.txt
commands={envbindir}/flake8 mkdocs --ignore=E128,E501 --exclude=__init__.py,compat.py