From 971537afda110d82378d04837ac647a43137f1c7 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 20 Jan 2009 23:08:11 +0000 Subject: - Tease out an extra 4% performance boost by changing the Router; instead of using imported ZCA APIs, use the same APIs directly against the registry that is an attribute of the Router. As a result, the registry used by BFG is now a subclass of ``zope.component.registry.Components`` (defined as ``repoze.bfg.registry.Registry``); it has a ``notify`` method. --- repoze/bfg/tests/test_registry.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'repoze/bfg/tests/test_registry.py') diff --git a/repoze/bfg/tests/test_registry.py b/repoze/bfg/tests/test_registry.py index edd45b458..2c26d850e 100644 --- a/repoze/bfg/tests/test_registry.py +++ b/repoze/bfg/tests/test_registry.py @@ -2,6 +2,24 @@ import unittest from zope.testing.cleanup import cleanUp +class TestRegistry(unittest.TestCase): + def _getTargetClass(self): + from repoze.bfg.registry import Registry + return Registry + + def _makeOne(self): + return self._getTargetClass()() + + def test_notify(self): + registry = self._makeOne() + L = [] + def subscribers(events, *arg): + L.extend(events) + return ['abc'] + registry.subscribers = subscribers + registry.notify('123') + self.assertEqual(L, ['123']) + class TestPopulateRegistry(unittest.TestCase): def setUp(self): cleanUp() -- cgit v1.2.3