[Checkins] SVN: zc.ngi/trunk/async_txt.py Removed unused file.
Jim Fulton
jim at zope.com
Wed Feb 21 16:16:30 EST 2007
Log message for revision 72751:
Removed unused file.
Changed:
D zc.ngi/trunk/async_txt.py
-=-
Deleted: zc.ngi/trunk/async_txt.py
===================================================================
--- zc.ngi/trunk/async_txt.py 2007-02-21 18:22:50 UTC (rev 72750)
+++ zc.ngi/trunk/async_txt.py 2007-02-21 21:16:29 UTC (rev 72751)
@@ -1,64 +0,0 @@
-"""Run the code used in the async.txt doc test to ease debugging
-"""
-
-import sys, logging
-sys.path.insert(0, 'src')
-handler = logging.StreamHandler()
-handler.setFormatter(logging.Formatter(
- "%(name)s %(lineno)s %(levelname)s: %(message)s"))
-logging.getLogger().addHandler(handler)
-logging.getLogger().setLevel(logging.WARNING)
-
-## The wordcount module has a simple word-count server and client
-## implementation. We'll run these using the async implementation.
-
-## Let's start the wordcount server:
-
-import zc.ngi.wordcount
-import zc.ngi.async
-import zc.ngi.testing
-port = zc.ngi.wordcount.start_server_process(zc.ngi.async.listener)
-
-## We passed the module and name of the listener to be used.
-
-## Now, we'll start a number of threads that connect to the server and
-## check word counts of some sample documents. If all goes well, we
-## shouldn't get any output.
-
-import threading
-addr = 'localhost', port
-threads = [threading.Thread(target=zc.ngi.wordcount.client_thread,
- args=(zc.ngi.async.connector, addr))
- for i in range(200)]
-
-_ = [thread.start() for thread in threads]
-_ = [thread.join() for thread in threads]
-
-zc.ngi.wordcount.stop_server_process(zc.ngi.async.connector, addr)
-
-## Let's make sure that the connector handles connection failures correctly
-
-import threading
-lock = threading.Lock()
-_ = lock.acquire()
-
-## We define a simple handler that just notifies of failed connectioons.
-
-class Handler:
- def failed_connect(connection, reason):
- print 'failed', reason
- lock.release()
-
-def connect(addr):
- zc.ngi.async.connector(addr, Handler())
- lock.acquire()
-
-## We find an unused port (so when we connect to it, the connection
-## will fail).
-
-port = zc.ngi.testing.get_port()
-
-## Now let's try to connect
-
-connect(('localhost', port))
-## failed connection failed
More information about the Checkins
mailing list