summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_registry.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-20 23:08:11 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-20 23:08:11 +0000
commit971537afda110d82378d04837ac647a43137f1c7 (patch)
tree69365f7f1de169ed97f4a215c55ad8c11f1be916 /repoze/bfg/tests/test_registry.py
parentbe39fa02f8c496461306ec2ce06a2708c377b509 (diff)
downloadpyramid-971537afda110d82378d04837ac647a43137f1c7.tar.gz
pyramid-971537afda110d82378d04837ac647a43137f1c7.tar.bz2
pyramid-971537afda110d82378d04837ac647a43137f1c7.zip
- 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.
Diffstat (limited to 'repoze/bfg/tests/test_registry.py')
-rw-r--r--repoze/bfg/tests/test_registry.py18
1 files changed, 18 insertions, 0 deletions
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()