Commit 629a9ae9 authored by Denis Bilenko's avatar Denis Bilenko

fix patched test_threading.py to actually test monkey patched threads in...

fix patched test_threading.py to actually test monkey patched threads in subprocess (previoulsly it tested regular threads)
parent cfaf3c73
......@@ -36,6 +36,7 @@ test_patched_urllib2.*
test_patched_ssl.*
test_patched_signal.BasicSignalTests.*
test_patched_threading_local.*
test_patched_threading.*
'''
......@@ -71,6 +72,9 @@ disabled_tests = \
[ 'test_threading.ThreadTests.test_PyThreadState_SetAsyncExc'
# uses some internal C API of threads not available when threads are emulated with greenlets
, 'test_threading.ThreadTests.test_join_nondaemon_on_shutdown'
# asserts that repr(sleep) is '<built-in function sleep>'
, 'test_urllib2net.TimeoutTest.test_ftp_no_timeout'
, 'test_urllib2net.TimeoutTest.test_ftp_timeout'
, 'test_urllib2net.TimeoutTest.test_http_no_timeout'
......@@ -106,10 +110,6 @@ disabled_tests = \
# maybe it should?
]
if sys.version_info[:2] < (2, 7):
# On Python 2.6, this test fails even without monkey patching
disabled_tests.append('test_threading.ThreadTests.test_foreign_thread')
def disable_tests_in_source(source, name):
my_disabled_tests = [x for x in disabled_tests if x.startswith(name + '.')]
......
import helper
exec helper.prepare_stdlib_test(__file__) in globals()
module = helper.prepare_stdlib_test(__file__)
import sys
import subprocess
from subprocess import Popen as _Popen
monkey_patch = 'from gevent import monkey; monkey.patch_all()\n\n'
class MyPopen(_Popen):
def __init__(self, arg, *args, **kwargs):
if arg[:2] == [sys.executable, '-c']:
assert len(arg) == 3, arg
arg = arg[:2] + [monkey_patch + arg[2]]
_Popen.__init__(self, arg, *args, **kwargs)
subprocess.Popen = MyPopen
exec module in globals()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment