[Zope3-checkins] CVS: Zope3/src/zope/hookable/tests - __init__.py:1.1 test_hookable.py:1.1
Jim Fulton
jim@zope.com
Sun, 18 May 2003 14:03:57 -0400
Update of /cvs-repository/Zope3/src/zope/hookable/tests
In directory cvs.zope.org:/tmp/cvs-serv8898/src/zope/hookable/tests
Added Files:
__init__.py test_hookable.py
Log Message:
Added a simple hooking mechanism.
See the doc string in __init__.py.
This has three advantages over the older hooking mechanism:
1. It is simpler to write hookable functions. You don't need to write
a seprate function that just dispatches to the hook.
2. When analyzing profile data, you will see the actual callers of the
hook function. Before, the hook function would only have the
dispatcher as a caller (unless other functions called it directly
without going through the dispatcher).
3. There is a small performance benefit, because the dispatcher is in
C, rather than Python. In the long run, I suspect that this will
save about 1-2 percent of execution time.
=== Added File Zope3/src/zope/hookable/tests/__init__.py ===
# This line required to prevent an empty file.
=== Added File Zope3/src/zope/hookable/tests/test_hookable.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test the hookable support Extension
$Id: test_hookable.py,v 1.1 2003/05/18 18:03:56 jim Exp $
"""
from zope.testing.doctestunit import DocTestSuite
def test_suite():
return DocTestSuite('zope.hookable')
if __name__ == '__main__':
import unittest
unittest.main()