summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asynchat.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-04-06 16:43:49 (GMT)
committerGuido van Rossum <guido@python.org>2001-04-06 16:43:49 (GMT)
commitdca060c55c5eb4cb7b43faec7fb1a85217d1e752 (patch)
tree2d8e6c23acac41cb759c5fa19c73fadee4fe130c /Lib/test/test_asynchat.py
parent66172520ee5b0762274f010e0bfdffd1559876f3 (diff)
downloadcpython-dca060c55c5eb4cb7b43faec7fb1a85217d1e752.zip
cpython-dca060c55c5eb4cb7b43faec7fb1a85217d1e752.tar.gz
cpython-dca060c55c5eb4cb7b43faec7fb1a85217d1e752.tar.bz2
After testing the test on Unix, several improvements:
- Use push() instead of send(), and make these calls in main(). - Sleep a second to give the server thread time to initialize itself.
Diffstat (limited to 'Lib/test/test_asynchat.py')
-rw-r--r--Lib/test/test_asynchat.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 3d31524..c887cec 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -1,6 +1,6 @@
# test asynchat -- requires threading
-import asyncore, asynchat, socket, threading
+import asyncore, asynchat, socket, threading, time
HOST = "127.0.0.1"
PORT = 54321
@@ -32,8 +32,6 @@ class echo_client(asynchat.async_chat):
self.connect((HOST, PORT))
self.set_terminator("\n")
self.buffer = ""
- self.send("hello ")
- self.send("world\n")
def handle_connect(self):
print "Connected"
@@ -49,7 +47,10 @@ class echo_client(asynchat.async_chat):
def main():
s = echo_server()
s.start()
+ time.sleep(1) # Give server time to initialize
c = echo_client()
+ c.push("hello ")
+ c.push("world\n")
asyncore.loop()
main()