[svn r63141] makegateway works for plain popen and popen+python-version
--HG-- branch : trunk
This commit is contained in:
parent
265e7c5dc2
commit
5f3fac94b6
|
@ -1,7 +1,9 @@
|
||||||
import py
|
import py
|
||||||
|
|
||||||
def test_XSpec_attributes():
|
|
||||||
XSpec = py.execnet.XSpec
|
XSpec = py.execnet.XSpec
|
||||||
|
|
||||||
|
class TestXSpec:
|
||||||
|
def test_attributes(self):
|
||||||
spec = XSpec("socket=192.168.102.2:8888//python=c:/this/python2.5//path=d:\hello")
|
spec = XSpec("socket=192.168.102.2:8888//python=c:/this/python2.5//path=d:\hello")
|
||||||
assert spec.socket == "192.168.102.2:8888"
|
assert spec.socket == "192.168.102.2:8888"
|
||||||
assert spec.python == "c:/this/python2.5"
|
assert spec.python == "c:/this/python2.5"
|
||||||
|
@ -23,12 +25,50 @@ def test_XSpec_attributes():
|
||||||
spec = XSpec("popen")
|
spec = XSpec("popen")
|
||||||
assert spec.popen == True
|
assert spec.popen == True
|
||||||
|
|
||||||
@py.test.mark.xfail
|
def test__samefilesystem(self):
|
||||||
def test_makegateway_popen():
|
assert XSpec("popen")._samefilesystem()
|
||||||
spec = py.execnet.XSpec("popen")
|
assert XSpec("popen//python=123")._samefilesystem()
|
||||||
gw = py.execnet.makegateway(spec)
|
assert not XSpec("popen//path=hello")._samefilesystem()
|
||||||
assert gw.spec == spec
|
|
||||||
rinfo = gw.remote_info()
|
class TestMakegateway:
|
||||||
|
def test_popen(self):
|
||||||
|
gw = py.execnet.makegateway("popen")
|
||||||
|
assert gw.spec.python == None
|
||||||
|
rinfo = gw._rinfo()
|
||||||
assert rinfo.executable == py.std.sys.executable
|
assert rinfo.executable == py.std.sys.executable
|
||||||
assert rinfo.curdir == py.std.os.getcwd()
|
assert rinfo.cwd == py.std.os.getcwd()
|
||||||
assert rinfo.version_info == py.std.sys.version_info
|
assert rinfo.version_info == py.std.sys.version_info
|
||||||
|
|
||||||
|
def test_popen_explicit(self):
|
||||||
|
gw = py.execnet.makegateway("popen//python=%s" % py.std.sys.executable)
|
||||||
|
assert gw.spec.python == py.std.sys.executable
|
||||||
|
rinfo = gw._rinfo()
|
||||||
|
assert rinfo.executable == py.std.sys.executable
|
||||||
|
assert rinfo.cwd == py.std.os.getcwd()
|
||||||
|
assert rinfo.version_info == py.std.sys.version_info
|
||||||
|
|
||||||
|
def test_popen_cpython24(self):
|
||||||
|
for trypath in ('python2.4', r'C:\Python24\python.exe'):
|
||||||
|
cpython24 = py.path.local.sysfind(trypath)
|
||||||
|
if cpython24 is not None:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
py.test.skip("cpython2.4 not found")
|
||||||
|
gw = py.execnet.makegateway("popen//python=%s" % cpython24)
|
||||||
|
rinfo = gw._rinfo()
|
||||||
|
assert rinfo.executable == cpython24
|
||||||
|
assert rinfo.cwd == py.std.os.getcwd()
|
||||||
|
assert rinfo.version_info[:2] == (2,4)
|
||||||
|
|
||||||
|
def test_popen_cpython26(self):
|
||||||
|
for trypath in ('python2.6', r'C:\Python26\python.exe'):
|
||||||
|
cpython26 = py.path.local.sysfind(trypath)
|
||||||
|
if cpython26 is not None:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
py.test.skip("cpython2.6 not found")
|
||||||
|
gw = py.execnet.makegateway("popen//python=%s" % cpython26)
|
||||||
|
rinfo = gw._rinfo()
|
||||||
|
assert rinfo.executable == cpython26
|
||||||
|
assert rinfo.cwd == py.std.os.getcwd()
|
||||||
|
assert rinfo.version_info[:2] == (2,6)
|
||||||
|
|
|
@ -23,7 +23,13 @@ class XSpec:
|
||||||
raise AttributeError(name)
|
raise AttributeError(name)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _samefilesystem(self):
|
||||||
|
return bool(self.popen and not self.path)
|
||||||
|
|
||||||
def makegateway(spec):
|
def makegateway(spec):
|
||||||
pass
|
if not isinstance(spec, XSpec):
|
||||||
|
spec = XSpec(spec)
|
||||||
|
if spec.popen:
|
||||||
|
gw = py.execnet.PopenGateway(python=spec.python)
|
||||||
|
gw.spec = spec
|
||||||
|
return gw
|
||||||
|
|
Loading…
Reference in New Issue