Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
Changed the tests to create new connections rather than using closed
Browse files Browse the repository at this point in the history
connections. Apparentlu. NGI ignored a test connections closed state
and doesn't now. The current ngi behavior is an improvement, although
it should probably raise an exception when writing to a closed
connection.
  • Loading branch information
Jim Fulton committed Oct 28, 2009
1 parent fc3b119 commit 9f61904
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/zc/monitor/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Now we can give the hello command to the server:

We can pass a name:

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('hello Jim\n')
Hi Jim, nice to meet ya!
-> CLOSE
Expand All @@ -56,6 +58,8 @@ them so we can see what they do:
The first is the help command. Giving help without input, gives a
list of available commands:

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('help\n')
Supported commands:
hello -- Say hello
Expand All @@ -66,6 +70,8 @@ list of available commands:

We can get detailed help by specifying a command name:

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('help help\n')
Help for help:
<BLANKLINE>
Expand All @@ -76,6 +82,8 @@ We can get detailed help by specifying a command name:
<BLANKLINE>
-> CLOSE

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('help hello\n')
Help for hello:
<BLANKLINE>
Expand All @@ -91,6 +99,8 @@ 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.

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('interactive\n')
Interactive mode on. Use "quit" To exit.
>>> connection.test_input('help interactive\n')
Expand Down Expand Up @@ -136,6 +146,8 @@ Now we will use ``quit`` to close the connection.
Finally, it's worth noting that exceptions will generate a
traceback on the connection.

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('hello Jim 42\n') # doctest: +ELLIPSIS
Traceback (most recent call last):
...
Expand Down

0 comments on commit 9f61904

Please sign in to comment.