summaryrefslogtreecommitdiff
path: root/src/zope/component/tests
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2021-03-18 08:37:37 -0500
committerJason Madden <jamadden@gmail.com>2021-03-18 08:37:37 -0500
commit968ccad5f7e0c5417fb3908cf431e17da3beac50 (patch)
tree62a6189b8c6c4cbd8a9fa93a2edfb3a8bc094807 /src/zope/component/tests
parent41cafd34b01555bc5c8bb7fe1b6181a7acf32fe7 (diff)
downloadzope-component-issue59.tar.gz
Remove backwards compatibility imports.issue59
Fixes #59
Diffstat (limited to 'src/zope/component/tests')
-rw-r--r--src/zope/component/tests/test_interfaces.py40
-rw-r--r--src/zope/component/tests/test_registry.py27
2 files changed, 9 insertions, 58 deletions
diff --git a/src/zope/component/tests/test_interfaces.py b/src/zope/component/tests/test_interfaces.py
index 353a212..4d1794d 100644
--- a/src/zope/component/tests/test_interfaces.py
+++ b/src/zope/component/tests/test_interfaces.py
@@ -17,37 +17,13 @@ Tests for zope.component.interfaces
import unittest
-class TestBackwardsCompat(unittest.TestCase):
+class TestInterfaces(unittest.TestCase):
- def test_interface_warnings(self):
- from zope.component import interfaces
- import warnings
- for name in (
- 'ComponentLookupError',
- 'Invalid',
- 'IObjectEvent',
- 'ObjectEvent',
- 'IComponentLookup',
- 'IRegistration',
- 'IUtilityRegistration',
- '_IBaseAdapterRegistration',
- 'IAdapterRegistration',
- 'ISubscriptionAdapterRegistration',
- 'IHandlerRegistration',
- 'IRegistrationEvent',
- 'RegistrationEvent',
- 'IRegistered',
- 'Registered',
- 'IUnregistered',
- 'Unregistered',
- 'IComponentRegistry',
- 'IComponents',
- ):
- with warnings.catch_warnings(record=True) as log:
- warnings.simplefilter("always")
- getattr(interfaces, name)
+ def test_nothing(self):
+ """
+ This exists only so that zope.testrunner doesn't complain this
+ module has no tests.
- self.assertEqual(1, len(log), name)
- message = str(log[0].message)
- self.assertIn(name, message)
- self.assertIn("Import from zope.interface.interfaces", message)
+ Even though this file is empty, we want to keep it around for ease
+ of browsing the history.
+ """
diff --git a/src/zope/component/tests/test_registry.py b/src/zope/component/tests/test_registry.py
index 39f9f3c..1d02f86 100644
--- a/src/zope/component/tests/test_registry.py
+++ b/src/zope/component/tests/test_registry.py
@@ -105,36 +105,11 @@ class Test_dispatchHandlerRegistrationEvent(unittest.TestCase):
self.assertEqual(_handled, [(_registration.handler, _EVENT)])
-class TestBackwardsCompat(unittest.TestCase):
-
- def test_interface_warnings(self):
- from zope.component import registry
- import warnings
- for name in (
- 'Components',
- '_getUtilityProvided',
- '_getAdapterProvided',
- '_getAdapterRequired',
- 'UtilityRegistration',
- 'AdapterRegistration',
- 'SubscriptionRegistration',
- 'HandlerRegistration',
- ):
- with warnings.catch_warnings(record=True) as log:
- warnings.simplefilter("always")
- getattr(registry, name)
-
- self.assertEqual(1, len(log), name)
- message = str(log[0].message)
- self.assertIn(name, message)
- self.assertIn("Import from zope.interface.registry", message)
-
-
class _Monkey(object):
# context-manager for replacing module names in the scope of a test.
def __init__(self, module, **kw):
self.module = module
- self.to_restore = dict([(key, getattr(module, key)) for key in kw])
+ self.to_restore = {key: getattr(module, key) for key in kw}
for key, value in kw.items():
setattr(module, key, value)