diff options
author | Michele Simionato <michele.simionato@gmail.com> | 2011-06-05 11:56:50 +0200 |
---|---|---|
committer | Michele Simionato <michele.simionato@gmail.com> | 2011-06-05 11:56:50 +0200 |
commit | 2c9a92feab665152a02a7482bff9d31bafa2996e (patch) | |
tree | 45cd87cf2a0ba28882cdc552722bb0ee2001a6af /plac/doc | |
parent | 10e47a954cf45360667d4d581314663ee5626a13 (diff) | |
download | micheles-2c9a92feab665152a02a7482bff9d31bafa2996e.tar.gz |
Fixed a test with the server
Diffstat (limited to 'plac/doc')
-rw-r--r-- | plac/doc/example1.py | 1 | ||||
-rw-r--r-- | plac/doc/test_runp.py | 2 | ||||
-rw-r--r-- | plac/doc/test_server.py | 9 |
3 files changed, 5 insertions, 7 deletions
diff --git a/plac/doc/example1.py b/plac/doc/example1.py index a5071bb..f024090 100644 --- a/plac/doc/example1.py +++ b/plac/doc/example1.py @@ -1,7 +1,6 @@ # example1.py def main(dsn): "Do something with the database" - print(dsn) # ... if __name__ == '__main__': diff --git a/plac/doc/test_runp.py b/plac/doc/test_runp.py index 619fc1f..4cdd494 100644 --- a/plac/doc/test_runp.py +++ b/plac/doc/test_runp.py @@ -1,5 +1,5 @@ """ -This test should work on Linux if you have both Tkinter installed. +This test should work on Linux if you have Tkinter installed. """ from __future__ import with_statement diff --git a/plac/doc/test_server.py b/plac/doc/test_server.py index a46535d..adcc395 100644 --- a/plac/doc/test_server.py +++ b/plac/doc/test_server.py @@ -1,4 +1,4 @@ -import multiprocessing, subprocess, time, random +import multiprocessing, subprocess, random, time import plac from ishelve2 import ShelveInterface @@ -15,7 +15,6 @@ showall '''] def telnet(commands, port): - time.sleep(.5) # wait a bit for the server to start po = subprocess.Popen(['telnet', 'localhost', str(port)], stdin=subprocess.PIPE) try: @@ -27,13 +26,13 @@ def telnet(commands, port): def test(): port = random.choice(range(2000, 20000)) + server = multiprocessing.Process(target=i.start_server, args=(port,)) + server.start() clients = [] for cmds in COMMANDS: cl = multiprocessing.Process(target=telnet, args=(cmds, port)) clients.append(cl) cl.start() - - i.start_server(port, timeout=.5) for cl in clients: cl.join() - i.stop_server() + server.terminate() |