Skip to content

Commit

Permalink
Merge e60eb68 into a1b72cc
Browse files Browse the repository at this point in the history
  • Loading branch information
vernans committed Oct 6, 2018
2 parents a1b72cc + e60eb68 commit e80b4aa
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 28 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -5,6 +5,7 @@ omit =
src/zope/component/standalonetests.py
# Not used
src/zope/component/hookable.py
src/zope/component/eventtesting.py

[report]
exclude_lines =
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -12,6 +12,12 @@ python:
- pypy
- pypy3

matrix:
include:
- python: "3.7"
dist: xenial
sudo: true

script:
- coverage run -m zope.testrunner --test-path=src
- if [[ -z "$MINIMAL" ]]; then sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html; fi
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,9 +4,12 @@ Changes
4.4.2 (unreleased)
------------------

- Add support for Python 3.7.

- Always install ``zope.hookable`` as a dependency (the ``hook``
extra is now empty). ``zope.hookable`` respects the PURE_PYTHON
environment variable, and has an optional C extension.

- Make accessing names that have been moved to ``zope.interface``
produce a ``DeprecationWarning``.

Expand Down
13 changes: 6 additions & 7 deletions docs/zcml.rst
Expand Up @@ -139,9 +139,8 @@ Of course, if no factory is provided at all, we will get an error:
... />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-8.8
ValueError: No factory specified

ComponentConfigurationError: No factory specified
File "<string>", line 4.2-8.8

Declaring ``for``, ``provides`` and ``name`` in Python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -311,8 +310,8 @@ Chained factories are not supported for multi-adapters, though:
... />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-11.8
ValueError: Can't use multiple factories and multiple for
ComponentConfigurationError: Can't use multiple factories and multiple for
File "<string>", line 4.2-11.8

And neither for null-adapters:

Expand All @@ -328,8 +327,8 @@ And neither for null-adapters:
... />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-9.8
ValueError: Can't use multiple factories and multiple for
ComponentConfigurationError: Can't use multiple factories and multiple for
File "<string>", line 4.2-9.8

Protected adapters
~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -89,6 +89,7 @@ def read(*rnames):
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Zope3",
Expand Down
11 changes: 6 additions & 5 deletions src/zope/component/eventtesting.py
Expand Up @@ -13,6 +13,7 @@
##############################################################################
"""Placeless Test Setup
"""

from zope.component import provideHandler
from zope.component.event import objectEventNotify
from zope.component.registry import dispatchUtilityRegistrationEvent
Expand All @@ -22,12 +23,12 @@
from zope.component.registry import dispatchHandlerRegistrationEvent
try:
from zope.testing.cleanup import addCleanUp
except ImportError: #pragma NO COVER
except ImportError:
def addCleanUp(x):
pass

events = []
def getEvents(event_type=None, filter=None): #pragma NO COVER going aaway
def getEvents(event_type=None, filter=None):
r = []
for event in events:
if event_type is not None and not event_type.providedBy(event):
Expand All @@ -38,11 +39,11 @@ def getEvents(event_type=None, filter=None): #pragma NO COVER going aaway

return r

def clearEvents(): #pragma NO COVER going aaway
def clearEvents():
del events[:]
addCleanUp(clearEvents)

class PlacelessSetup: #pragma NO COVER going aaway
class PlacelessSetup:

def setUp(self):
provideHandler(objectEventNotify)
Expand All @@ -52,5 +53,5 @@ def setUp(self):
provideHandler(dispatchHandlerRegistrationEvent)
provideHandler(events.append, (None,))

def setUp(test=None): #pragma NO COVER going aaway
def setUp(test=None):
PlacelessSetup().setUp()
1 change: 1 addition & 0 deletions src/zope/component/hookable.py
Expand Up @@ -14,5 +14,6 @@
"""
This module is deprecated. Prefer to use zope.hookable.hookable.
"""
# pragma: no cover
import zope.deprecation
zope.deprecation.moved("zope.hookable", "4.5")
2 changes: 1 addition & 1 deletion src/zope/component/tests/__init__.py
Expand Up @@ -3,7 +3,7 @@
def skipIfNoSecurity(testfunc):
try:
import zope.security
except ImportError:
except ImportError: # pragma: no cover
return unittest.skip("zope.security not installed")(testfunc)
return testfunc

Expand Down
8 changes: 2 additions & 6 deletions src/zope/component/tests/test__declaration.py
Expand Up @@ -131,13 +131,9 @@ class IBar(Interface):
])
with warnings.catch_warnings(record=True) as log:
warnings.resetwarnings()
try:
with self.assertRaises(TypeError):
exec(CODE, globs, locs)
except TypeError:
if not PYTHON3:
self.assertEqual(len(log), 0) # no longer warn
else:
self.fail("Didn't raise TypeError")
self.assertEqual(len(log), 0) # no longer warn

def test_called_once_from_class(self):
from zope.component._declaration import adapts
Expand Down
13 changes: 5 additions & 8 deletions src/zope/component/tests/test_persistentregistry.py
Expand Up @@ -19,7 +19,7 @@
def skipIfNoPersistent(testfunc):
try:
import persistent
except ImportError:
except ImportError: # pragma: no cover
return unittest.skip("persistent not installed")(testfunc)
return testfunc

Expand All @@ -40,13 +40,13 @@ class _Cache(object):
def __init__(self, jar):
self._jar = jar
self._mru = []
def mru(self, oid):
self._mru.append(oid)
# mru(oid) is only called in pure-Python runs
self.mru = self._mru.append
def new_ghost(self, oid, obj):
obj._p_jar = self._jar
obj._p_oid = oid
def update_object_size_estimation(self, oid, size):
return
"This is only called in pure-Python runs"

return _Cache(jar)

Expand Down Expand Up @@ -160,7 +160,4 @@ def test_ctor_initializes_registries_and_registrations(self):
PersistentList))

def _makeOctets(s):
import sys
if sys.version_info < (3,):
return bytes(s)
return bytes(s, 'ascii') #pragma NO COVERAGE
return bytes(s) if bytes is str else bytes(s, 'ascii')
14 changes: 13 additions & 1 deletion tox.ini
Expand Up @@ -2,7 +2,7 @@
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,pypy,py34,py35,py36,pypy3,docs
py27,py27-minimal,pypy,py34,py35,py36,py37,pypy3,docs,coverage

[mindeps]
deps =
Expand Down Expand Up @@ -58,3 +58,15 @@ commands =
deps =
{[fulldeps]deps}
.[docs]

[testenv:coverage]
basepython =
python3.6
usedevelop = true
commands =
coverage run -m zope.testrunner --test-path=src
coverage run -a -m sphinx.cmd.build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
coverage report --fail-under=100
deps =
{[testenv]deps}
coverage

0 comments on commit e80b4aa

Please sign in to comment.