Skip to content

Commit

Permalink
Merge de12a4c into 9d64102
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Mar 22, 2020
2 parents 9d64102 + de12a4c commit 6342b1b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
@@ -1,5 +1,9 @@
language: python

env:
global:
ZOPE_INTERFACE_STRICT_IRO: 1

python:
- 2.7
- 3.5
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,8 @@ Changes
4.6.1 (unreleased)
------------------

- Nothing changed yet.
- Ensure the resolution order of ``BaseGlobalComponents`` is
consistent. See `issue 45 <https://github.com/zopefoundation/zope.component/issues/45>`_.


4.6 (2019-11-12)
Expand Down
2 changes: 1 addition & 1 deletion src/zope/component/globalregistry.py
Expand Up @@ -37,7 +37,7 @@ def __init__(self, parent, name):
def __reduce__(self):
return GAR, (self.__parent__, self.__name__)

@implementer(IComponentLookup)

class BaseGlobalComponents(Components):

def _init_registries(self):
Expand Down
28 changes: 28 additions & 0 deletions src/zope/component/tests/test_globalregistry.py
Expand Up @@ -244,3 +244,31 @@ class IFoo(Interface):
self.assertEqual(list(hr.required), [IFoo])
self.assertEqual(hr.name, '')
self.assertTrue(hr.factory is _handler)


class TestBaseGlobalComponents(unittest.TestCase):

from zope.component.testing import setUp, tearDown

def _getTargetClass(self):
from zope.component.globalregistry import BaseGlobalComponents
return BaseGlobalComponents

def _getTargetInterfaces(self):
from zope.interface.interfaces import IComponentLookup
from zope.interface.interfaces import IComponents
from zope.interface.interfaces import IComponentRegistry
return [IComponents, IComponentLookup, IComponentRegistry]

def _makeOne(self):
return self._getTargetClass()()

def test_verifyInstance(self):
from zope.interface.verify import verifyObject
for iface in self._getTargetInterfaces():
verifyObject(iface, self._makeOne())

def test_verifyClass(self):
from zope.interface.verify import verifyClass
for iface in self._getTargetInterfaces():
verifyClass(iface, self._getTargetClass())
10 changes: 4 additions & 6 deletions tox.ini
Expand Up @@ -19,6 +19,8 @@ deps =
commands =
zope-testrunner --test-path=src
sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
setenv =
ZOPE_INTERFACE_STRICT_IRO = 1

[testenv:py27-minimal]
basepython =
Expand All @@ -28,24 +30,20 @@ deps =
commands =
zope-testrunner --test-path=src

[testenv:py34-pure]
basepython =
python3.4
setenv =
PURE_PYTHON = 1
PIP_CACHE_DIR = {envdir}/.cache

[testenv:py35-pure]
basepython =
python3.5
setenv =
{[testenv]setenv}
PURE_PYTHON = 1
PIP_CACHE_DIR = {envdir}/.cache

[testenv:py27-pure]
basepython =
python3.4
setenv =
{[testenv]setenv}
PURE_PYTHON = 1
PIP_CACHE_DIR = {envdir}/.cache

Expand Down

0 comments on commit 6342b1b

Please sign in to comment.