Add python-eventlet package to MOS 9.0 repository
[packages/trusty/python-eventlet.git] / python-eventlet / tests / subprocess_test.py
index 085f656c1e8695cafa04c545a7e010f446b2bb40..1f07518332d0ab22a0cd1fb560c9fb84727211f2 100644 (file)
@@ -1,8 +1,10 @@
+import sys
+import time
+
 import eventlet
 from eventlet.green import subprocess
 import eventlet.patcher
-import sys
-import time
+import tests
 original_subprocess = eventlet.patcher.original('subprocess')
 
 
@@ -64,3 +66,20 @@ def test_close_popen_stdin_with_close_fds():
         p.stdin.close()
     except Exception as e:
         assert False, "Exception should not be raised, got %r instead" % e
+
+
+def test_universal_lines():
+    p = subprocess.Popen(
+        [sys.executable, '--version'],
+        shell=False,
+        stdout=subprocess.PIPE,
+        universal_newlines=True)
+    p.communicate(None)
+
+
+def test_patched_communicate_290():
+    # https://github.com/eventlet/eventlet/issues/290
+    # Certain order of import and monkey_patch breaks subprocess communicate()
+    # with AttributeError module `select` has no `poll` on Linux
+    # unpatched methods are removed for safety reasons in commit f63165c0e3
+    tests.run_isolated('subprocess_patched_communicate.py')