diff --git a/py/misc/conftest-socketgatewayrun.py b/py/misc/conftest-socketgatewayrun.py index 04e634416..99c2bd8d6 100644 --- a/py/misc/conftest-socketgatewayrun.py +++ b/py/misc/conftest-socketgatewayrun.py @@ -28,8 +28,8 @@ class MyRSync(py.execnet.RSync): return True class MySession(RemoteTerminalSession): - socketserveradr = ('10.9.4.148', 8888) socketserveradr = ('10.9.2.62', 8888) + socketserveradr = ('10.9.4.148', 8888) def _initslavegateway(self): print "MASTER: initializing remote socket gateway" @@ -59,3 +59,5 @@ class MySession(RemoteTerminalSession): assert remotepypath.startswith(topdir), (remotepypath, topdir) #print "remote side has rsynced pythonpath ready: %r" %(topdir,) return gw, topdir + +dist_hosts = ['localhost', 'cobra', 'cobra'] diff --git a/py/misc/killproc.py b/py/misc/killproc.py new file mode 100644 index 000000000..890798766 --- /dev/null +++ b/py/misc/killproc.py @@ -0,0 +1,10 @@ + +import py +import os, sys + +def killproc(pid): + if sys.platform == "win32": + py.process.cmdexec("taskkill /F /PID %d" %(pid,)) + else: + os.kill(pid, 15) + diff --git a/py/misc/testing/test_oskill.py b/py/misc/testing/test_oskill.py new file mode 100644 index 000000000..4518332ae --- /dev/null +++ b/py/misc/testing/test_oskill.py @@ -0,0 +1,15 @@ + +import py, sys + +from py.__.misc.killproc import killproc + +def test_win_killsubprocess(): + tmp = py.test.ensuretemp("test_win_killsubprocess") + t = tmp.join("t.py") + 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 + killproc(proc.pid) + ret = proc.wait() + assert ret != 0 +