Skip to content

Commit

Permalink
Fix tox and travis by using zope.testrunner
Browse files Browse the repository at this point in the history
DRY with regards to dependencies. This lets us simplify travis to not
use Tox which in turn lets us easily enable coveralls.

Fixes #26
  • Loading branch information
jamadden committed Jun 29, 2017
1 parent b88e39b commit bdfe453
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 85 deletions.
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[run]
source = zope.component

[report]
# "pragma NO COVER" is a legacy spelling
exclude_lines =
pragma: no cover
pragma NO COVER
if __name__ == '__main__':
raise NotImplementedError
53 changes: 35 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,41 @@ language: python
sudo: false
matrix:
include:
- python: 2.7
env: PURE_PYTHON=1
- python: 2.7
env: DOCS=1
# The doctests only run on Python 2.7
- python: 2.7
env: MINIMAL="-t !persistentregistry -t !security"
- python: 3.5
env: TOXENV=py35
- python: 3.5
env: TOXENV=py35-pure
env:
- TOXENV=py27
- TOXENV=py27-minimal
- TOXENV=py27-pure
- TOXENV=pypy
- TOXENV=py33
- TOXENV=py34
- TOXENV=py34-pure
- TOXENV=pypy3
- TOXENV=coverage
- TOXENV=docs
install:
- pip install tox
env: PURE_PYTHON=1
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy-5.6.0
- pypy3.3-5.5-alpha

script:
- tox
- coverage run -m zope.testrunner --test-path=src $MINIMAL
- if [[ -n "$DOCS" ]]; then sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html; fi
- if [[ -n "$DOCS" ]]; then sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest; fi

after_success:
- coveralls
notifications:
email: false
email: false

install:
- pip install -U pip setuptools
- pip install -U coveralls coverage
- if [[ -n "$MINIMAL" ]]; then pip install -U -e ".[mintests]"; fi
- if [[ -z "$MINIMAL" ]]; then pip install -U -e ".[test,docs]"; fi


cache: pip

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changes
4.4.0 (unreleased)
------------------

- Nothing changed yet.
- Add support for Python 3.6.

- Drop support for Python 3.3.


4.3.0 (2016-08-26)
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ where=src
[aliases]
dev = develop easy_install zope.component[testing]
docs = easy_install zope.component[docs]

[bdist_wheel]
universal = 1
91 changes: 60 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,41 @@
import os
from setuptools import setup, find_packages

HOOK_REQUIRES = [
'zope.hookable',
]

TESTS_REQUIRE = [
'zope.testing',
'zope.component[hook]',
'zope.component[persistentregistry]',
'zope.component[security]',
'zope.component[zcml]',
PERSISTENTREGISTRY_REQUIRES = [
'persistent',
]

SECURITY_REQUIRES = [
'zope.location',
'zope.proxy',
'zope.security',
]

ZCML_REQUIRES = [
'zope.configuration',
'zope.i18nmessageid',
]

MIN_TESTS_REQUIRE = (
HOOK_REQUIRES
+ ZCML_REQUIRES
+ [
'zope.testing',
'zope.testrunner',
]
)

TESTS_REQUIRE = (
MIN_TESTS_REQUIRE
+ PERSISTENTREGISTRY_REQUIRES
+ SECURITY_REQUIRES
)



def _modname(path, base, name=''):
if path == base:
Expand Down Expand Up @@ -66,7 +93,8 @@ def emit(self, record):


def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()

setup(
name='zope.component',
Expand All @@ -80,9 +108,9 @@ def read(*rnames):
read('README.rst')
+ '\n' +
read('CHANGES.rst')
),
packages = find_packages('src'),
package_dir = {'': 'src'},
),
packages=find_packages('src'),
package_dir={'': 'src'},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -96,32 +124,33 @@ def read(*rnames):
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Zope3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
namespace_packages=['zope',],
tests_require = TESTS_REQUIRE,
tests_require=TESTS_REQUIRE,
test_suite='__main__.alltests',
install_requires=['setuptools',
'zope.interface>=4.1.0',
'zope.event',
],
include_package_data = True,
zip_safe = False,
extras_require = {
'hook': ['zope.hookable'],
'persistentregistry': ['persistent'],
'security': ['zope.location',
'zope.proxy',
'zope.security',
],
'zcml': ['zope.configuration',
'zope.i18nmessageid',
],
install_requires=[
'setuptools',
'zope.interface>=4.1.0',
'zope.event',
],
include_package_data=True,
zip_safe=False,
extras_require={
'hook': HOOK_REQUIRES,
'persistentregistry': PERSISTENTREGISTRY_REQUIRES,
'security': SECURITY_REQUIRES,
'zcml': ZCML_REQUIRES,
'mintests': MIN_TESTS_REQUIRE,
'test': TESTS_REQUIRE,
'testing': TESTS_REQUIRE + ['nose', 'coverage'],
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
)
'docs': [
'Sphinx',
'repoze.sphinx.autointerface',
'ZODB',
],
},
)
41 changes: 6 additions & 35 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,29 @@
envlist =
# Jython support pending 2.7 support, due 2012-07-15 or so. See:
# http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
py27,py27-minimal,py27-pure,pypy,py33,py34,py34-pure,py35,py35-pure,pypy3,coverage,docs
py27,py27-minimal,py27-pure,pypy,py33,py34,py34-pure,py35,py35-pure,py36,pypy3,coverage,docs

[mindeps]
deps =
zope.event
zope.hookable
zope.i18nmessageid
zope.interface
zope.schema
zope.configuration
.[mintests]

[fulldeps]
deps =
{[mindeps]deps}
persistent
zope.location
zope.proxy
zope.security
zope.testing
.[test]

[testenv]
deps =
{[fulldeps]deps}
commands =
python setup.py -q test -q
zope-testrunner --test-path=src

[testenv:py27-minimal]
usedevelop = true
basepython =
python2.7
deps =
{[mindeps]deps}
ordereddict
nose
commands =
nosetests -I persistentregistry -I security
zope-testrunner --test-path=src -t !persistentregistry -t !security

[testenv:py34-pure]
basepython =
Expand All @@ -60,18 +47,6 @@ setenv =
PURE_PYTHON = 1
PIP_CACHE_DIR = {envdir}/.cache

[testenv:coverage]
usedevelop = true
basepython =
python2.7
commands =
nosetests --with-xunit --with-xcoverage
deps =
{[fulldeps]deps}
nose
coverage
nosexcover

[testenv:docs]
basepython =
python2.7
Expand All @@ -80,8 +55,4 @@ commands =
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
deps =
{[fulldeps]deps}
ZODB3
Sphinx
repoze.sphinx.autointerface
# Ugh. Need this for docs/testlayer.rst
zope.testrunner
.[docs]

0 comments on commit bdfe453

Please sign in to comment.