From ac4a900e5e216bf54f76fad31632db062b20d700 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 20 Aug 2014 20:11:32 +0100 Subject: [PATCH 1/2] 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. --- .travis.sh | 10 ++++++++++ .travis.yml | 31 ++++++++++++++----------------- requirements.txt | 2 -- runtests | 8 -------- test-requirements.txt | 3 +++ tox.ini | 13 ++++++++++--- 6 files changed, 37 insertions(+), 30 deletions(-) create mode 100755 .travis.sh delete mode 100755 runtests create mode 100644 test-requirements.txt diff --git a/.travis.sh b/.travis.sh new file mode 100755 index 00000000..ab95ebbc --- /dev/null +++ b/.travis.sh @@ -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 diff --git a/.travis.yml b/.travis.yml index 301f7689..158770ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index 38f7c8bf..8d4a9a7c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/runtests b/runtests deleted file mode 100755 index 4be83c64..00000000 --- a/runtests +++ /dev/null @@ -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 diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..9e8ef9b6 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +coverage +flake8 +nose diff --git a/tox.ini b/tox.ini index a109aff8..9b2dbcba 100644 --- a/tox.ini +++ b/tox.ini @@ -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 From fa8566a1a165b0e5d5ac46a38e80c7987a4b7c07 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 1 Oct 2014 20:02:04 +0100 Subject: [PATCH 2/2] Removed flake8 exclusion that wasn't needed --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9b2dbcba..7d609ffe 100644 --- a/tox.ini +++ b/tox.ini @@ -13,4 +13,4 @@ commands={envbindir}/mkdocs build [testenv:flake8] deps=-rtest-requirements.txt -commands={envbindir}/flake8 mkdocs --ignore=E128,E501 --exclude=__init__.py,compat.py +commands={envbindir}/flake8 mkdocs --ignore=E128,E501 --exclude=mkdocs/compat.py