From 71e332c9c4acbc10d8af0c1248d1e231147e1726 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 29 Dec 2009 12:36:45 +0100 Subject: [PATCH] robustiy some randomly failing tests --HG-- branch : trunk --- bin-for-dist/test_install.py | 3 ++- py/impl/path/svnwc.py | 2 +- testing/path/test_local.py | 2 ++ testing/path/test_svnwc.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin-for-dist/test_install.py b/bin-for-dist/test_install.py index 0a4e1eb47..245386cec 100644 --- a/bin-for-dist/test_install.py +++ b/bin-for-dist/test_install.py @@ -147,7 +147,8 @@ def test_plugin_setuptools_entry_point_integration(py_setup, venv, tmpdir): out = venv.pytest_getouterr("-h") assert "testpluginopt" in out -def test_cmdline_entrypoints(): +def test_cmdline_entrypoints(monkeypatch): + monkeypatch.syspath_prepend(py.path.local(__file__).dirpath().dirpath()) from setup import cmdline_entrypoints versioned_scripts = ['py.test', 'py.which'] unversioned_scripts = versioned_scripts + [ 'py.cleanup', diff --git a/py/impl/path/svnwc.py b/py/impl/path/svnwc.py index 0d172f859..4cafbff9c 100644 --- a/py/impl/path/svnwc.py +++ b/py/impl/path/svnwc.py @@ -429,6 +429,7 @@ class SvnWCCommandPath(common.PathBase): return self strpath = property(lambda x: str(x.localpath), None, None, "string path") + rev = property(lambda x: x.info(usecache=0).rev, None, None, "revision") def __eq__(self, other): return self.localpath == getattr(other, 'localpath', None) @@ -796,7 +797,6 @@ recursively. """ raise py.error.ENOENT(self, "not a versioned resource:" + " %s != %s" % (info.path, self.localpath)) cache.info[self] = info - self.rev = info.rev return info def listdir(self, fil=None, sort=None): diff --git a/testing/path/test_local.py b/testing/path/test_local.py index 19af970b0..0efae9be7 100644 --- a/testing/path/test_local.py +++ b/testing/path/test_local.py @@ -499,7 +499,9 @@ class TestPOSIXLocalPath: # we could wait here but timer resolution is very # system dependent path.read() + time.sleep(0.01) atime2 = path.atime() + time.sleep(0.01) duration = time.time() - now assert (atime2-atime1) <= duration diff --git a/testing/path/test_svnwc.py b/testing/path/test_svnwc.py index 032649700..93d900d33 100644 --- a/testing/path/test_svnwc.py +++ b/testing/path/test_svnwc.py @@ -12,7 +12,7 @@ def test_make_repo(path1, tmpdir): repo = py.path.svnurl("file://%s" % repo) wc = py.path.svnwc(tmpdir.join("wc")) wc.checkout(repo) - assert wc.info().rev == 0 + assert wc.rev == 0 assert len(wc.listdir()) == 0 p = wc.join("a_file") p.write("test file")