From ee8a1bd6de7548b629f513227028229c5b37adf4 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Jun 2017 08:33:56 +0200 Subject: [PATCH] Update testing infrastructure to match current usage. --- .coveragerc | 13 +++++++++++ .gitignore | 1 + .travis.yml | 29 +++++++++++++----------- setup.py | 15 ------------- tox.ini | 65 +++++++++++++++++++++++++---------------------------- 5 files changed, 61 insertions(+), 62 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..12ca7bf --- /dev/null +++ b/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True +source = zope.annotation + +[report] +precision = 2 + +[paths] +source = + src/ + .tox/py*/lib/python*/site-packages/ + .tox/nobtree/lib/python*/site-packages/ + .tox/pypy*/site-packages/ diff --git a/.gitignore b/.gitignore index a5cca41..b25eed6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ coverage.xml docs/_build +htmlcov/ diff --git a/.travis.yml b/.travis.yml index 9829f38..6b71eab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,21 @@ language: python sudo: false -matrix: - include: - - python: 3.5 - env: TOXENV=py35 -env: - - TOXENV=py27 - - TOXENV=py33 - - TOXENV=py34 - - TOXENV=pypy - - TOXENV=pypy3 +python: + - 2.7 + - 3.3 + - 3.4 + - 3.5 + - pypy-5.4.1 install: - - travis_retry pip install tox + - pip install -U pip setuptools zope.testrunner + - pip install -U coveralls coverage + - pip install -U -e ".[test]" script: - - tox + - coverage run -m zope.testrunner --test-path=src --auto-color +after_success: + - coveralls notifications: - email: false + email: false +cache: pip +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log diff --git a/setup.py b/setup.py index 335b00a..19cd0b5 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ """Setup for zope.annotation package """ import os -import sys from setuptools import setup, find_packages @@ -27,20 +26,6 @@ def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: return f.read() -def alltests(): - # use the zope.testrunner machinery to find all the - # test suites we've put under ourselves - from zope.testrunner.options import get_options - from zope.testrunner.find import find_suites - from unittest import TestSuite - here = os.path.abspath(os.path.dirname(sys.argv[0])) - args = sys.argv[:] - src = os.path.join(here, 'src') - defaults = ['--test-path', src] - options = get_options(args, defaults) - suites = list(find_suites(options)) - return TestSuite(suites) - tests_require = [ 'zope.component[zcml]', 'zope.configuration', diff --git a/tox.ini b/tox.ini index ec178d6..014e3e1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,45 +1,31 @@ [tox] envlist = - py27,py33,py34,py35,pypy,pypy3,nobtree,coverage,docs - -[base] -deps = - zope.component[zcml] - zope.configuration - zope.interface - zope.location - zope.proxy - zope.testrunner - zope.testing + py27, + py33, + py34, + py35, + pypy, + pypy3, + nobtree, + docs, + coverage, [testenv] commands = - python setup.py -q test -q -# without explicit deps, setup.py test will download a bunch of eggs into $PWD + coverage run -m zope.testrunner --test-path=src {posargs:-vc} deps = - {[base]deps} - BTrees - persistent + .[brees,test] + zope.testrunner + coverage +setenv = + COVERAGE_FILE=.coverage.{envname} [testenv:nobtree] basepython = python2.7 -commands = - python setup.py -q test -q -# without explicit deps, setup.py test will download a bunch of eggs into $PWD -deps = - {[base]deps} - -[testenv:coverage] -basepython = - python2.7 -commands = - coverage erase - coverage run --source=src setup.py -q test -q - coverage report --show-missing - coverage xml deps = - {[base]deps} + .[test] + zope.testrunner coverage [testenv:docs] @@ -49,6 +35,17 @@ commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest deps = - {[testenv]deps} - Sphinx - repoze.sphinx.autointerface + .[docs] + +[testenv:coverage] +basepython = python2.7 +deps = coverage +setenv = + COVERAGE_FILE=.coverage +skip_install = true +commands = + coverage erase + coverage combine + coverage html + coverage xml + coverage report --show-missing