<s> import sys <EOL> import time <EOL> import eventlet <EOL> from eventlet . green import subprocess <EOL> import eventlet . patcher <EOL> import tests <EOL> original_subprocess = eventlet . patcher . original ( '<STR_LIT>' ) <EOL> def test_subprocess_wait ( ) : <EOL> cmd = [ sys . executable , "<STR_LIT:-c>" , "<STR_LIT>" ] <EOL> p = subprocess . Popen ( cmd ) <EOL> ok = False <EOL> t1 = time . time ( ) <EOL> try : <EOL> p . wait ( timeout = <NUM_LIT:0.1> ) <EOL> except subprocess . TimeoutExpired as e : <EOL> str ( e ) <EOL> assert e . cmd == cmd <EOL> assert e . timeout == <NUM_LIT:0.1> <EOL> ok = True <EOL> tdiff = time . time ( ) - t1 <EOL> assert ok , '<STR_LIT>' <EOL> assert <NUM_LIT:0.1> <= tdiff <= <NUM_LIT> , '<STR_LIT>' <EOL> def test_communicate_with_poll ( ) : <EOL> p = subprocess . Popen ( <EOL> [ sys . executable , '<STR_LIT:-c>' , '<STR_LIT>' ] , <EOL> stdout = subprocess . PIPE , stderr = subprocess . PIPE ) <EOL> t1 = time . time ( ) <EOL> eventlet . with_timeout ( <NUM_LIT:0.1> , p . communicate , timeout_value = True ) <EOL> tdiff = time . time ( ) - t1 <EOL> assert <NUM_LIT:0.1> <= tdiff <= <NUM_LIT> , '<STR_LIT>' <EOL> def test_close_popen_stdin_with_close_fds ( ) : <EOL> p = subprocess . Popen ( <EOL> [ '<STR_LIT>' ] , <EOL> stdin = subprocess . PIPE , <EOL> stdout = subprocess . PIPE , <EOL> stderr = subprocess . PIPE , <EOL> close_fds = True , <EOL> shell = False , <EOL> cwd = None , <EOL> env = None ) <EOL> p . communicate ( None ) <EOL> try : <EOL> p . stdin . close ( ) <EOL> except Exception as e : <EOL> assert False , "<STR_LIT>" % e <EOL> def test_universal_lines ( ) : <EOL> p = subprocess . Popen ( <EOL> [ sys . executable , '<STR_LIT>' ] , <EOL> shell = False , <EOL> stdout = subprocess . PIPE , <EOL> universal_newlines = True ) <EOL> p . communicate ( None ) <EOL> def test_patched_communicate_290 ( ) : <EOL> tests . run_isolated ( '<STR_LIT>' ) </s>
