From e84068b51897df26583f15afc734dfc24c55b625 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Tue, 14 Oct 2014 15:49:59 +0300 Subject: [PATCH] Use tox in .travis.yml. This way we can avoid code duplication. Also, this change makes tests faster due to ignoring the sdist step and adds Python 3.2, 3.4 and PyPy 3 to build matrix. --- .travis.yml | 22 ++++++++++------------ MANIFEST.in | 1 + Makefile | 2 +- requirements_dev.txt | 4 ++-- requirements_test.txt | 2 ++ setup.py | 4 ++-- tox.ini | 15 ++++++++------- 7 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 requirements_test.txt diff --git a/.travis.yml b/.travis.yml index 00f396aa..411a935c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,11 @@ language: python -python: - - "2.6" - - "2.7" - - "3.3" - - "3.4" - - "pypy" -install: - - if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install aiohttp; fi -script: python setup.py test -branches: - only: - - master +env: + - TOXENV=py26 + - TOXENV=py27 + - TOXENV=py32 + - TOXENV=py33 + - TOXENV=py34 + - TOXENV=pypy + - TOXENV=pypy3 +install: pip install tox +script: tox diff --git a/MANIFEST.in b/MANIFEST.in index c011fea6..edf1811e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include NOTICE include README.rst include THANKS include requirements_dev.txt +include requirements_test.txt recursive-include tests * recursive-include examples * recursive-include docs * diff --git a/Makefile b/Makefile index d9b3622d..3641cd5a 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ coverage: venv/bin/python setup.py test --cov clean: - @rm -rf .Python MANIFEST build dist venv* *.egg-info + @rm -rf .Python MANIFEST build dist venv* *.egg-info *.egg @find . -type f -name "*.py[co]" -delete @find . -type d -name "__pycache__" -delete diff --git a/requirements_dev.txt b/requirements_dev.txt index 2529754e..a36971d5 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pytest==2.6.3 -pytest-cov==1.7.0 +-r requirements_test.txt + sphinx sphinx_rtd_theme diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 00000000..3e2bb35d --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,2 @@ +pytest==2.6.3 +pytest-cov==1.7.0 diff --git a/setup.py b/setup.py index e302a3d2..3ca0daeb 100644 --- a/setup.py +++ b/setup.py @@ -40,9 +40,9 @@ with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: long_description = f.read() # read dev requirements -fname = os.path.join(os.path.dirname(__file__), 'requirements_dev.txt') +fname = os.path.join(os.path.dirname(__file__), 'requirements_test.txt') with open(fname) as f: - tests_require = list(map(lambda l: l.strip(), f.readlines())) + tests_require = [l.strip() for l in f.readlines()] if sys.version_info[:2] < (3, 3): tests_require.append('mock') diff --git a/tox.ini b/tox.ini index 42eadd0d..b0d5d839 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,12 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - [tox] -envlist = py26, py27, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy, pypy3 +skipsdist = True [testenv] +usedevelop = True commands = py.test tests/ -deps = pytest +deps = + -rrequirements_test.txt + py26: unittest2 + py2{6,7},pypy,py32,pypy3: mock + py3{3,4}: aiohttp