From 1e84a3c451f9c9fd78c63d606cefb04b18957578 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 7 May 2009 21:04:56 +0200 Subject: [PATCH] fixing a windows issues --HG-- branch : trunk --- py/__init__.py | 4 ++-- py/path/svn/svncommon.py | 11 +++++++++++ py/path/svn/testing/test_urlcommand.py | 2 +- py/path/svn/urlcommand.py | 8 +------- py/test/plugin/pytest_pytester.py | 4 +++- py/test/testing/test_pluginmanager.py | 2 -- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/py/__init__.py b/py/__init__.py index 0371fabfb..d16105739 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -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, diff --git a/py/path/svn/svncommon.py b/py/path/svn/svncommon.py index c9ace8e66..92e098ed0 100644 --- a/py/path/svn/svncommon.py +++ b/py/path/svn/svncommon.py @@ -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): diff --git a/py/path/svn/testing/test_urlcommand.py b/py/path/svn/testing/test_urlcommand.py index e3138859c..966d6c738 100644 --- a/py/path/svn/testing/test_urlcommand.py +++ b/py/path/svn/testing/test_urlcommand.py @@ -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/@@@:')") diff --git a/py/path/svn/urlcommand.py b/py/path/svn/urlcommand.py index d569c53c0..8fea634ff 100644 --- a/py/path/svn/urlcommand.py +++ b/py/path/svn/urlcommand.py @@ -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 diff --git a/py/test/plugin/pytest_pytester.py b/py/test/plugin/pytest_pytester.py index 47c2697ae..46c0ace98 100644 --- a/py/test/plugin/pytest_pytester.py +++ b/py/test/plugin/pytest_pytester.py @@ -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): diff --git a/py/test/testing/test_pluginmanager.py b/py/test/testing/test_pluginmanager.py index 63345bc0c..4abed9552 100644 --- a/py/test/testing/test_pluginmanager.py +++ b/py/test/testing/test_pluginmanager.py @@ -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