fixing a windows issues

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-05-07 21:04:56 +02:00
parent b7fe3ee2b3
commit 1e84a3c451
6 changed files with 18 additions and 13 deletions

View File

@ -25,8 +25,8 @@ version = "1.0.0b2"
initpkg(__name__,
description = "pylib and py.test: agile development and test support library",
revision = int('$LastChangedRevision: 64000 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2009-04-13 01:05:08 +0200 (Mon, 13 Apr 2009) $',
revision = int('$LastChangedRevision: 65143 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2009-05-07 19:37:45 +0200 (Thu, 07 May 2009) $',
version = version,
url = "http://pylib.org",
download_url = "http://codespeak.net/py/%s/download.html" % version,

View File

@ -35,6 +35,17 @@ def _check_for_bad_chars(text, allowed_chars=ALLOWED_CHARS):
return True
return False
def checkbadchars(url):
# (hpk) not quite sure about the exact purpose, guido w.?
proto, uri = url.split("://", 1)
if proto != "file":
host, uripath = uri.split('/', 1)
# only check for bad chars in the non-protocol parts
if (_check_for_bad_chars(host, ALLOWED_CHARS_HOST) \
or _check_for_bad_chars(uripath, ALLOWED_CHARS)):
raise ValueError("bad char in %r" % (url, ))
#_______________________________________________________________
class SvnPathBase(common.FSPathBase):

View File

@ -124,4 +124,4 @@ class TestSvnInfoCommand:
assert info.kind == 'dir'
def test_badchars():
py.test.raises(ValueError, "py.path.svnurl('file:///tmp/@@@:')")
py.test.raises(ValueError, "py.path.svnurl('http://host/tmp/@@@:')")

View File

@ -28,13 +28,7 @@ class SvnCommandPath(svncommon.SvnPathBase):
rev = path.rev
auth = path.auth
path = path.strpath
proto, uri = path.split("://", 1)
host, uripath = uri.split('/', 1)
# only check for bad chars in the non-protocol parts
if (svncommon._check_for_bad_chars(host, svncommon.ALLOWED_CHARS_HOST)
or svncommon._check_for_bad_chars(uripath,
svncommon.ALLOWED_CHARS)):
raise ValueError("bad char in path %s" % (path, ))
svncommon.checkbadchars(path)
path = path.rstrip('/')
self.strpath = path
self.rev = rev

View File

@ -224,8 +224,10 @@ class TmpTestdir:
if not hasattr(py.std, 'subprocess'):
py.test.skip("no subprocess module")
env = os.environ.copy()
env['PYTHONPATH'] = "%s:%s" % (os.getcwd(), env['PYTHONPATH'])
env['PYTHONPATH'] = ":".join(filter(None, [
str(os.getcwd()), env.get('PYTHONPATH', '')]))
kw['env'] = env
#print "env", env
return py.std.subprocess.Popen(cmdargs, stdout=stdout, stderr=stderr, **kw)
def run(self, *cmdargs):

View File

@ -36,8 +36,6 @@ class TestBootstrapping:
plugin = py.test.config.pluginmanager.getplugin('x500')
assert plugin is not None
""")
new = str(x500.dirpath()) # "%s:%s" %(x500.dirpath(), os.environ.get('PYTHONPATH', ''))
monkeypatch.setitem(os.environ, 'PYTHONPATH', new)
monkeypatch.setitem(os.environ, 'PYTEST_PLUGINS', 'pytest_x500')
result = testdir.runpytest(p)
assert result.ret == 0