summaryrefslogtreecommitdiff
path: root/tests/stdlib
diff options
context:
space:
mode:
authorRyan Williams <rdw@lindenlab.com>2009-11-30 01:57:55 -0500
committerRyan Williams <rdw@lindenlab.com>2009-11-30 01:57:55 -0500
commite49fa06db612558af69b84d54fd4d357d4a746b7 (patch)
treeb83d47f9e91577c6c9639b3691d5994cd57479b0 /tests/stdlib
parent1cedca5f141ae268ceff3ee79fb9fb473b62b76b (diff)
downloadeventlet-e49fa06db612558af69b84d54fd4d357d4a746b7.tar.gz
Fleshed out the rest of eventlet.green.thread, tweaked all.py so it discerns which tests will run when the frikkin internet is down, and used the improved corolocal that Tyler and I worked on (and fixed some bugs with it that these tests revealed.
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/all.py35
-rw-r--r--tests/stdlib/test_socket_ssl.py6
2 files changed, 33 insertions, 8 deletions
diff --git a/tests/stdlib/all.py b/tests/stdlib/all.py
index e6bc043..b1d7cfc 100644
--- a/tests/stdlib/all.py
+++ b/tests/stdlib/all.py
@@ -17,22 +17,41 @@ def import_main(g, name):
modobj.test_main.__name__ = name + '.test_main'
except AttributeError:
print "No test_main for %s, assuming it tests on import" % name
-
+
+
+# quick and dirty way of testing whether we can access
+# remote hosts; any tests that try internet connections
+# will fail if we cannot
+import socket
+s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+try:
+ s.settimeout(0.5)
+ s.connect(('eventlet.net', 80))
+ s.close()
+ have_network_access = True
+except socket.error, e:
+ have_network_access = False
+
+
import_main(globals(), 'test_SimpleHTTPServer')
import_main(globals(), 'test_asynchat')
import_main(globals(), 'test_asyncore')
import_main(globals(), 'test_ftplib')
import_main(globals(), 'test_httplib')
-#import_main(globals(), 'test_httpservers')
+if have_network_access:
+ import_main(globals(), 'test_httpservers')
import_main(globals(), 'test_select')
-import_main(globals(), 'test_socket')
-#import_main(globals(), 'test_socket_ssl')
+if have_network_access:
+ import_main(globals(), 'test_socket')
+import_main(globals(), 'test_socket_ssl')
import_main(globals(), 'test_socketserver')
#import_main(globals(), 'test_ssl')
import_main(globals(), 'test_thread')
-#import_main(globals(), 'test_threading')
-#import_main(globals(), 'test_threading_local')
-import_main(globals(), 'test_timeout')
+import_main(globals(), 'test_threading')
+import_main(globals(), 'test_threading_local')
+if have_network_access:
+ import_main(globals(), 'test_timeout')
import_main(globals(), 'test_urllib')
-import_main(globals(), 'test_urllib2')
+if have_network_access:
+ import_main(globals(), 'test_urllib2')
import_main(globals(), 'test_urllib2_localnet') \ No newline at end of file
diff --git a/tests/stdlib/test_socket_ssl.py b/tests/stdlib/test_socket_ssl.py
index 55cea01..d7fb21d 100644
--- a/tests/stdlib/test_socket_ssl.py
+++ b/tests/stdlib/test_socket_ssl.py
@@ -5,6 +5,12 @@ from eventlet.green import socket
from eventlet.green import urllib
from eventlet.green import threading
+try:
+ socket.ssl
+ socket.sslerror
+except AttributeError:
+ raise ImportError("Socket module doesn't support ssl")
+
patcher.inject('test.test_socket_ssl',
globals(),
('socket', socket),