summaryrefslogtreecommitdiff
path: root/tests/stdlib/test_threading.py
diff options
context:
space:
mode:
authorRyan Williams <rdw@lindenlab.com>2009-11-29 22:17:26 -0500
committerRyan Williams <rdw@lindenlab.com>2009-11-29 22:17:26 -0500
commit1cedca5f141ae268ceff3ee79fb9fb473b62b76b (patch)
treed68626519f769afa09ea77846af012fad32a29f5 /tests/stdlib/test_threading.py
parentb48299f73b848ec963a724d7f58fcad76d993a14 (diff)
downloadeventlet-1cedca5f141ae268ceff3ee79fb9fb473b62b76b.tar.gz
Patcherized threading and its test, removing a ton of copy-and-pasted code in the process. :-)
Diffstat (limited to 'tests/stdlib/test_threading.py')
-rw-r--r--tests/stdlib/test_threading.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/stdlib/test_threading.py b/tests/stdlib/test_threading.py
index 5fcc4b4..1b87e32 100644
--- a/tests/stdlib/test_threading.py
+++ b/tests/stdlib/test_threading.py
@@ -1,20 +1,22 @@
-# Very rudimentary test of threading module
-
+from eventlet import patcher
from eventlet.green import threading
from eventlet.green import thread
from eventlet.green import time
-# 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
+# *NOTE: doesn't test as much of the threading api as we'd like because many of
+# the tests are launched via subprocess and therefore don't get patched
+
+patcher.inject('test.test_threading',
+ globals(),
+ ('threading', threading),
+ ('thread', thread),
+ ('time', time))
-from test import test_threading
-test_threading.thread = thread
-test_threading.time = time
+# "PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
+# exposed at the Python level. This test relies on ctypes to get at it."
+# Therefore it's also disabled when testing eventlet, as it's not emulated.
+ThreadTests.test_PyThreadState_SetAsyncExc = lambda s: None
-from test.test_threading import *
if __name__ == "__main__":
test_main() \ No newline at end of file