diff options
| -rw-r--r-- | CHANGES.txt | 17 | ||||
| -rw-r--r-- | docs/conf.py | 4 | ||||
| -rw-r--r-- | repoze/bfg/testing.py | 7 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_testing.py | 17 | ||||
| -rw-r--r-- | setup.py | 2 |
5 files changed, 37 insertions, 10 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index b56c86879..01f6d3676 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,11 +1,20 @@ +0.4.7 (11/11/2008) + + Features + + - Allow ``testing.registerEventListener`` to be used with Zope 3 + style "object events" (subscribers accept more than a single event + argument). We extend the list with the arguments, rather than + append. + 0.4.6 (11/10/2008) Bug Fixes - - The ``model_path`` and ``model_url`` traversal APIs returned the - wrong value for the root object (e.g. ``model_path`` returned - ``''`` for the root object, while it should have been returning - ``'/'``). + - The ``model_path`` and ``model_url`` traversal APIs returned the + wrong value for the root object (e.g. ``model_path`` returned + ``''`` for the root object, while it should have been returning + ``'/'``). 0.4.5 (11/9/2008) diff --git a/docs/conf.py b/docs/conf.py index 5a109946f..fc8cc1378 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,9 +51,9 @@ copyright = '2008, Agendaless Consulting' # other places throughout the built documents. # # The short X.Y version. -version = '0.4.6' +version = '0.4.7' # The full version, including alpha/beta/rc tags. -release = '0.4.6' +release = '0.4.7' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/repoze/bfg/testing.py b/repoze/bfg/testing.py index 26690c48d..a7fc12827 100644 --- a/repoze/bfg/testing.py +++ b/repoze/bfg/testing.py @@ -44,10 +44,11 @@ def registerEventListener(event_iface=Interface): matches ``event_iface``, that event will be appended to the list. You can then compare the values in the list to expected event notifications. This method is useful when testing code that wants - to call ``zope.component.event.dispatch``.""" + to call ``zope.component.event.dispatch`` or + ``zope.component.event.objectEventNotify``.""" L = [] - def subscriber(event): - L.append(event) + def subscriber(*event): + L.extend(event) registerSubscriber(subscriber, event_iface) return L diff --git a/repoze/bfg/tests/test_testing.py b/repoze/bfg/tests/test_testing.py index abd955c96..598436c1a 100644 --- a/repoze/bfg/tests/test_testing.py +++ b/repoze/bfg/tests/test_testing.py @@ -74,6 +74,23 @@ class TestTestingFunctions(unittest.TestCase, PlacelessSetup): self.assertEqual(L[0], event) dispatch(object()) self.assertEqual(len(L), 1) + + def test_registerEventListener_multiple(self): + from repoze.bfg import testing + from zope.interface import implements + from zope.interface import Interface + class IEvent(Interface): + pass + class Event: + object = 'foo' + implements(IEvent) + L = testing.registerEventListener((Interface, IEvent)) + from zope.component.event import objectEventNotify + event = Event() + objectEventNotify(event) + self.assertEqual(len(L), 2) + self.assertEqual(L[0], 'foo') + self.assertEqual(L[1], event) def test_registerEventListener_defaults(self): from repoze.bfg import testing @@ -12,7 +12,7 @@ # ############################################################################## -__version__ = '0.4.6' +__version__ = '0.4.7' import os |
