X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=python-eventlet%2Ftests%2Fpatcher_test.py;h=7ec12b12e67f30e83f85d9982eee721c99077630;hb=refs%2Ftags%2Fmos-9.0;hp=2e458c557dff97cf73c412cf5d745df610b4f594;hpb=358bd9258c2b6d2ee74de4dfd07a5123107abad4;p=packages%2Ftrusty%2Fpython-eventlet.git diff --git a/python-eventlet/tests/patcher_test.py b/python-eventlet/tests/patcher_test.py index 2e458c5..7ec12b1 100644 --- a/python-eventlet/tests/patcher_test.py +++ b/python-eventlet/tests/patcher_test.py @@ -291,18 +291,20 @@ import time self.assertEqual(len(lines), 2, "\n".join(lines)) -class Subprocess(ProcessBase): - def test_monkeypatched_subprocess(self): - new_mod = """import eventlet +def test_subprocess_after_monkey_patch(): + code = '''\ +import sys +import eventlet eventlet.monkey_patch() from eventlet.green import subprocess - -subprocess.Popen(['true'], stdin=subprocess.PIPE) -print("done") -""" - self.write_to_tempfile("newmod", new_mod) - output, lines = self.launch_subprocess('newmod') - self.assertEqual(output, "done\n", output) +subprocess.Popen([sys.executable, '-c', ''], stdin=subprocess.PIPE).wait() +print('pass') +''' + output = tests.run_python( + path=None, + args=['-c', code], + ) + assert output.rstrip() == b'pass' class Threading(ProcessBase): @@ -324,8 +326,8 @@ print(len(_threading._active)) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 4, "\n".join(lines)) assert lines[0].startswith('