diff options
| author | Ryan Williams <rdw@lindenlab.com> | 2009-11-27 12:19:12 -0500 |
|---|---|---|
| committer | Ryan Williams <rdw@lindenlab.com> | 2009-11-27 12:19:12 -0500 |
| commit | 773633b6873f2b0f8b7e14e8150e5a34f7058af6 (patch) | |
| tree | a2255da98db7455179ee88d848842045ae8062c6 /tests/stdlib | |
| parent | 3a5f4ea908a9b3b0f2447606ec19a4fa6e5a0ed3 (diff) | |
| download | eventlet-773633b6873f2b0f8b7e14e8150e5a34f7058af6.tar.gz | |
Patcher-ized test_socket_ssl and test_socketserver. Also patcher-ized SocketServer, which allows it to successfullly pass its unit tests, which it failed previously because it was making a call to non-greened select.select().
Diffstat (limited to 'tests/stdlib')
| -rw-r--r-- | tests/stdlib/test_socket_ssl.py | 19 | ||||
| -rw-r--r-- | tests/stdlib/test_socketserver.py | 31 |
2 files changed, 19 insertions, 31 deletions
diff --git a/tests/stdlib/test_socket_ssl.py b/tests/stdlib/test_socket_ssl.py index 2a2a579..55cea01 100644 --- a/tests/stdlib/test_socket_ssl.py +++ b/tests/stdlib/test_socket_ssl.py @@ -1,20 +1,15 @@ #!/usr/bin/env python -from test import test_socket_ssl - +from eventlet import patcher from eventlet.green import socket from eventlet.green import urllib from eventlet.green import threading -test_socket_ssl.socket = socket -# bwahaha -import sys -sys.modules['urllib'] = urllib -sys.modules['threading'] = threading -# to get past the silly 'requires' check -test_socket_ssl.__name__ = '__main__' - -from test.test_socket_ssl import * +patcher.inject('test.test_socket_ssl', + globals(), + ('socket', socket), + ('urllib', urllib), + ('threading', threading)) if __name__ == "__main__": - test_main()
\ No newline at end of file + test_main() diff --git a/tests/stdlib/test_socketserver.py b/tests/stdlib/test_socketserver.py index 61d5942..40e0a96 100644 --- a/tests/stdlib/test_socketserver.py +++ b/tests/stdlib/test_socketserver.py @@ -1,30 +1,23 @@ #!/usr/bin/env python -# to get past the silly 'requires' check -from test import test_support -test_support.use_resources = ['network'] - +from eventlet import patcher from eventlet.green import SocketServer from eventlet.green import socket from eventlet.green import select from eventlet.green import time from eventlet.green import threading -# need to override these modules before import so -# that classes inheriting from threading.Thread refer -# to the correct module -import sys -sys.modules['threading'] = threading -sys.modules['SocketServer'] = SocketServer - -from test import test_socketserver - -test_socketserver.socket = socket -test_socketserver.select = select -test_socketserver.time = time +# to get past the silly 'requires' check +from test import test_support +test_support.use_resources = ['network'] -# skipping these tests for now -#from test.test_socketserver import * +patcher.inject('test.test_socketserver', + globals(), + ('SocketServer', SocketServer), + ('socket', socket), + ('select', select), + ('time', time), + ('threading', threading)) if __name__ == "__main__": - pass#test_main()
\ No newline at end of file + test_main()
\ No newline at end of file |
