[py-svn] r8313 - in py/dist/py/path/local: . testing
hpk at codespeak.net
hpk at codespeak.net
Sun Jan 16 18:59:43 CET 2005
Author: hpk
Date: Sun Jan 16 18:59:43 2005
New Revision: 8313
Modified:
py/dist/py/path/local/local.py
py/dist/py/path/local/testing/test_local.py
Log:
yet some more windows support:
x = py.path.local.sysfind("python")
now works (and you may even succeed running
x.sysexec("-c", "print 42")
if you have win32all installed).
Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py (original)
+++ py/dist/py/path/local/local.py Sun Jan 16 18:59:43 2005
@@ -388,13 +388,20 @@
Note: This is probably not working on plain win32 systems
but may work on cygwin.
"""
- for x in py.std.os.environ['PATH'].split(':'):
- p = py.path.local(x).join(name)
- if p.check(file=1):
- if checker:
- if not checker(p):
- continue
- return p
+ if py.std.sys.platform == 'win32':
+ paths = py.std.os.environ['Path'].split(';')
+ tryadd = '', '.exe', '.com', '.bat' # XXX add more?
+ else:
+ paths = py.std.os.environ['PATH'].split(':')
+ tryadd = ('',)
+ for x in paths:
+ for addext in tryadd:
+ p = py.path.local(x).join(name) + addext
+ if p.check(file=1):
+ if checker:
+ if not checker(p):
+ continue
+ return p
raise py.error.ENOENT(name)
sysfind = classmethod(sysfind)
#"""
Modified: py/dist/py/path/local/testing/test_local.py
==============================================================================
--- py/dist/py/path/local/testing/test_local.py (original)
+++ py/dist/py/path/local/testing/test_local.py Sun Jan 16 18:59:43 2005
@@ -126,6 +126,16 @@
assert t == newfile
assert newfile.check(dir=1)
+class TestExecutionOnWindows(LocalSetup):
+ disabled = py.std.sys.platform != 'win32'
+
+ def test_sysfind(self):
+ x = py.path.local.sysfind('cmd')
+ assert x.check(file=1)
+ py.test.raises(py.error.ENOENT, """
+ py.path.local.sysfind('jaksdkasldqwe')
+ """)
+
class TestExecution(LocalSetup):
disabled = py.std.sys.platform == 'win32'
More information about the pytest-commit
mailing list