diff --git a/tests/stdlib/all.py b/tests/stdlib/all.py index 1734c5f..e6bc043 100644 --- a/tests/stdlib/all.py +++ b/tests/stdlib/all.py @@ -34,5 +34,5 @@ import_main(globals(), 'test_thread') #import_main(globals(), 'test_threading_local') import_main(globals(), 'test_timeout') import_main(globals(), 'test_urllib') -#import_main(globals(), 'test_urllib2') -#import_main(globals(), 'test_urllib2_localnet') \ No newline at end of file +import_main(globals(), 'test_urllib2') +import_main(globals(), 'test_urllib2_localnet') \ No newline at end of file diff --git a/tests/stdlib/test_urllib2_localnet.py b/tests/stdlib/test_urllib2_localnet.py index 9917038..48316ba 100644 --- a/tests/stdlib/test_urllib2_localnet.py +++ b/tests/stdlib/test_urllib2_localnet.py @@ -1,24 +1,16 @@ -#!/usr/bin/env python +from eventlet import patcher +from eventlet.green import BaseHTTPServer from eventlet.green import threading from eventlet.green import socket from eventlet.green import urllib2 -from eventlet.green import BaseHTTPServer - -# need to override these modules before import so -# that classes inheriting from threading.Thread refer -# to the correct parent class -import sys -sys.modules['threading'] = threading -sys.modules['BaseHTTPServer'] = BaseHTTPServer - -from test import test_urllib2_localnet - -test_urllib2_localnet.socket = socket -test_urllib2_localnet.urllib2 = urllib2 -test_urllib2_localnet.BaseHTTPServer = BaseHTTPServer - -from test.test_urllib2_localnet import * +patcher.inject('test.test_urllib2_localnet', + globals(), + ('BaseHTTPServer', BaseHTTPServer), + ('threading', threading), + ('socket', socket), + ('urllib2', urllib2)) + if __name__ == "__main__": test_main() \ No newline at end of file