summaryrefslogtreecommitdiff
path: root/tests/stdlib/all.py
diff options
context:
space:
mode:
authorRyan Williams <rdw@lindenlab.com>2010-02-14 19:42:27 -0800
committerRyan Williams <rdw@lindenlab.com>2010-02-14 19:42:27 -0800
commit19739f9d6dcbd3998c202b75bf3790d6a0fb4b7b (patch)
treef0fd38c39c7c5b180dd978d98acc52195ea69abf /tests/stdlib/all.py
parenta95682c039d0fad13a0477f11902ebe0b48aac73 (diff)
downloadeventlet-19739f9d6dcbd3998c202b75bf3790d6a0fb4b7b.tar.gz
Adding hub reset method around the stdlib tests prevents bad data from spilling between them.
Diffstat (limited to 'tests/stdlib/all.py')
-rw-r--r--tests/stdlib/all.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/stdlib/all.py b/tests/stdlib/all.py
index 5236e7c..2a1a9b5 100644
--- a/tests/stdlib/all.py
+++ b/tests/stdlib/all.py
@@ -4,16 +4,28 @@ Many of these tests make connections to external servers, and all.py tries to sk
"""
+def restart_hub():
+ from eventlet import hubs
+ hub = hubs.get_hub()
+ hub.abort()
+ hub_shortname = hub.__module__.split('.')[-1]
+ hubs.use_hub(hub_shortname)
+
def assimilate_patched(name):
try:
modobj = __import__(name, globals(), locals(), ['test_main'])
+ restart_hub()
except ImportError:
print "Not importing %s, it doesn't exist in this installation/version of Python" % name
return
else:
method_name = name + "_test_main"
try:
- globals()[method_name] = modobj.test_main
+ test_method = modobj.test_main
+ def test_main():
+ test_method()
+ restart_hub()
+ globals()[method_name] = test_main
modobj.test_main.__name__ = name + '.test_main'
except AttributeError:
print "No test_main for %s, assuming it tests on import" % name