Add python-eventlet 0.16.1
[packages/trusty/python-eventlet.git] / eventlet / tests / stdlib / test_threading.py
1 from eventlet import patcher
2 from eventlet.green import threading
3 from eventlet.green import thread
4 from eventlet.green import time
5
6 # *NOTE: doesn't test as much of the threading api as we'd like because many of
7 # the tests are launched via subprocess and therefore don't get patched
8
9 patcher.inject('test.test_threading',
10                globals())
11
12 # "PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
13 # exposed at the Python level.  This test relies on ctypes to get at it."
14 # Therefore it's also disabled when testing eventlet, as it's not emulated.
15 try:
16     ThreadTests.test_PyThreadState_SetAsyncExc = lambda s: None
17 except (AttributeError, NameError):
18     pass
19
20 # disabling this test because it fails when run in Hudson even though it always
21 # succeeds when run manually
22 try:
23     ThreadJoinOnShutdown.test_3_join_in_forked_from_thread = lambda *a, **kw: None
24 except (AttributeError, NameError):
25     pass
26
27 # disabling this test because it relies on dorking with the hidden
28 # innards of the threading module in a way that doesn't appear to work
29 # when patched
30 try:
31     ThreadTests.test_limbo_cleanup = lambda *a, **kw: None
32 except (AttributeError, NameError):
33     pass
34
35 # this test has nothing to do with Eventlet; if it fails it's not
36 # because of patching (which it does, grump grump)
37 try:
38     ThreadTests.test_finalize_runnning_thread = lambda *a, **kw: None
39     # it's misspelled in the stdlib, silencing this version as well because
40     # inevitably someone will correct the error
41     ThreadTests.test_finalize_running_thread = lambda *a, **kw: None
42 except (AttributeError, NameError):
43     pass
44
45 if __name__ == "__main__":
46     test_main()