2008-09-23 22:28:13 +08:00
|
|
|
|
|
|
|
import py, sys
|
|
|
|
|
2009-12-30 05:26:03 +08:00
|
|
|
def test_kill(tmpdir):
|
2008-09-23 22:28:13 +08:00
|
|
|
subprocess = py.test.importorskip("subprocess")
|
2009-12-30 05:26:03 +08:00
|
|
|
t = tmpdir.join("t.py")
|
2008-09-23 22:28:13 +08:00
|
|
|
t.write("import time ; time.sleep(100)")
|
|
|
|
proc = py.std.subprocess.Popen([sys.executable, str(t)])
|
|
|
|
assert proc.poll() is None # no return value yet
|
|
|
|
py.process.kill(proc.pid)
|
|
|
|
ret = proc.wait()
|
2009-03-19 04:49:38 +08:00
|
|
|
if sys.platform == "win32" and ret == 0:
|
|
|
|
py.test.skip("XXX on win32, subprocess.Popen().wait() on a killed "
|
|
|
|
"process does not yield return value != 0")
|
2008-09-23 22:28:13 +08:00
|
|
|
assert ret != 0
|