[Checkins] SVN: zc.monitor/branches/benji-add-sticky-commands/s fix test bug caused by closing a test connection actually rendering the
Benji York
benji at zope.com
Wed Oct 28 10:59:47 EDT 2009
Log message for revision 105335:
fix test bug caused by closing a test connection actually rendering the
test connection unusable (although it would have been nice to raise an
exception upon subsequent writes)
Changed:
U zc.monitor/branches/benji-add-sticky-commands/setup.py
U zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/README.txt
U zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/tests.py
-=-
Modified: zc.monitor/branches/benji-add-sticky-commands/setup.py
===================================================================
--- zc.monitor/branches/benji-add-sticky-commands/setup.py 2009-10-28 14:36:19 UTC (rev 105334)
+++ zc.monitor/branches/benji-add-sticky-commands/setup.py 2009-10-28 14:59:47 UTC (rev 105335)
@@ -20,7 +20,7 @@
namespace_packages = ['zc'],
package_dir = {'': 'src'},
install_requires = [
- 'setuptools', 'zc.ngi==1.0.1', 'zope.component', 'zope.testing',
+ 'setuptools', 'zc.ngi', 'zope.component', 'zope.testing',
],
include_package_data = True,
zip_safe = False,
Modified: zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/README.txt
===================================================================
--- zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/README.txt 2009-10-28 14:36:19 UTC (rev 105334)
+++ zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/README.txt 2009-10-28 14:59:47 UTC (rev 105335)
@@ -3,15 +3,8 @@
==============
The monitor server is a server that provides a command-line interface to
-request various bits of information. The server is zc.ngi based, so we can use
-the zc.ngi testing infrastructure to demonstrate it.
+request various bits of information.
- >>> import zc.ngi.testing
- >>> import zc.monitor
-
- >>> connection = zc.ngi.testing.TextConnection()
- >>> server = zc.monitor.Server(connection)
-
The server supports an extensible set of commands. It looks up
commands as named zc.monitor.interfaces.IMonitorPlugin "utilities", as defined
by the zope.component package.
@@ -31,13 +24,13 @@
>>> zope.component.provideUtility(
... hello, zc.monitor.interfaces.IMonitorPlugin, 'hello')
-Now we can give the hello command to the server:
+Now we can give the hello command to the server [#setup]_:
>>> connection.test_input('hello\n')
Hi world, nice to meet ya!
-> CLOSE
-We can pass a name:
+We can pass a name [#setup]_:
>>> connection.test_input('hello Jim\n')
Hi Jim, nice to meet ya!
@@ -54,7 +47,7 @@
... zc.monitor.interfaces.IMonitorPlugin, 'quit')
The first is the help command. Giving help without input, gives a
-list of available commands:
+list of available commands [#setup]_:
>>> connection.test_input('help\n')
Supported commands:
@@ -64,8 +57,19 @@
quit -- Quit the monitor
-> CLOSE
-We can get detailed help by specifying a command name:
+We can get detailed help by specifying a command name [#setup]_:
+ >>> connection.test_input('help hello\n')
+ Help for hello:
+ <BLANKLINE>
+ Say hello
+ <BLANKLINE>
+ Provide a name if you're not the world.
+ <BLANKLINE>
+ -> CLOSE
+
+We can get even get help on the help command itself [#setup]_:
+
>>> connection.test_input('help help\n')
Help for help:
<BLANKLINE>
@@ -76,20 +80,11 @@
<BLANKLINE>
-> CLOSE
- >>> connection.test_input('help hello\n')
- Help for hello:
- <BLANKLINE>
- Say hello
- <BLANKLINE>
- Provide a name if you're not the world.
- <BLANKLINE>
- -> CLOSE
-
The ``interactive`` command switches the monitor into interactive mode. As
seen above, the monitor usually responds to a single command and then closes
the connection. In "interactive mode", the connection is not closed until
the ``quit`` command is used. This can be useful when accessing the monitor
-via telnet for diagnostics.
+via telnet for diagnostics. [#setup]_
>>> connection.test_input('interactive\n')
Interactive mode on. Use "quit" To exit.
@@ -134,17 +129,15 @@
-> CLOSE
Finally, it's worth noting that exceptions will generate a
-traceback on the connection.
+traceback on the connection. [#setup]_
-XXX For some reason the below doesn't work.
+ >>> connection.test_input('hello Jim 42\n') # doctest: +ELLIPSIS
+ Traceback (most recent call last):
+ ...
+ TypeError: hello() takes at most 2 arguments (3 given)
+ <BLANKLINE>
+ -> CLOSE
-FAIL >>> connection.test_input('hello Jim 42\n') # doctest: +ELLIPSIS
-FAIL Traceback (most recent call last):
-FAIL ...
-FAIL TypeError: hello() takes at most 2 arguments (3 given)
-FAIL <BLANKLINE>
-FAIL -> CLOSE
-
.. Edge cases
Closing the connection:
@@ -177,10 +170,8 @@
>>> zope.component.provideUtility(calc,
... zc.monitor.interfaces.IMonitorPlugin, 'calc')
-...we can invoke it and we get a prompt.
+...we can invoke it and we get a prompt. [#setup]_
- >>> connection = zc.ngi.testing.TextConnection()
- >>> server = zc.monitor.Server(connection)
>>> connection.test_input('calc\n')
.
@@ -198,3 +189,13 @@
>>> connection.test_input('quit\n')
-> CLOSE
+
+
+.. [#setup] The server is zc.ngi based, so we can use the zc.ngi testing
+ infrastructure to demonstrate it.
+
+ >>> import zc.ngi.testing
+ >>> import zc.monitor
+
+ >>> connection = zc.ngi.testing.TextConnection()
+ >>> server = zc.monitor.Server(connection)
Modified: zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/tests.py
===================================================================
--- zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/tests.py 2009-10-28 14:36:19 UTC (rev 105334)
+++ zc.monitor/branches/benji-add-sticky-commands/src/zc/monitor/tests.py 2009-10-28 14:59:47 UTC (rev 105335)
@@ -17,5 +17,5 @@
def test_suite():
return doctest.DocFileSuite(
'README.txt',
- optionflags=doctest.NORMALIZE_WHITESPACE,
+ optionflags=doctest.NORMALIZE_WHITESPACE | doctest.INTERPRET_FOOTNOTES,
)
More information about the checkins
mailing list