streamline svn test setup a bit, clear caches on setup-restore, hopefully will erase random failures with test_export.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-12-30 13:05:08 +01:00
parent 4656bc4c97
commit 89f178bf4d
8 changed files with 20 additions and 39 deletions

View File

@ -16,6 +16,9 @@ class BasicCache(object):
self.prunenum = int(maxentries - maxentries/8)
self._dict = {}
def clear(self):
self._dict.clear()
def _getentry(self, key):
return self._dict[key]

View File

@ -213,6 +213,17 @@ checkin message msg."""
lines = [x.strip() for x in lines[1:]]
return svncommon.PropListDict(self, lines)
def info(self):
""" return an Info structure with svn-provided information. """
parent = self.dirpath()
nameinfo_seq = parent._listdir_nameinfo()
bn = self.basename
for name, info in nameinfo_seq:
if name == bn:
return info
raise py.error.ENOENT(self)
def _listdir_nameinfo(self):
""" return sequence of name-info directory entries of self """
def builder():

View File

@ -235,16 +235,6 @@ class SvnPathBase(common.PathBase):
content = self._proplist()
return content
def info(self):
""" return an Info structure with svn-provided information. """
parent = self.dirpath()
nameinfo_seq = parent._listdir_nameinfo()
bn = self.basename
for name, info in nameinfo_seq:
if name == bn:
return info
raise py.error.ENOENT(self)
def size(self):
""" Return the size of the file content of the Path. """
return self.info().size

View File

@ -378,7 +378,7 @@ class CommonFSTests(object):
newp.move(p)
assert p.check()
def test_move_directory(self, path1):
def test_move_dir(self, path1):
source = path1.join('sampledir')
dest = path1.join('moveddir')
source.move(dest)

View File

@ -76,3 +76,5 @@ def restore_repowc(obj):
repo.remove()
savedrepo.move(repo)
savedwc.localpath.move(wc.localpath)
py.path.svnurl._lsnorevcache.clear()
py.path.svnurl._lsrevcache.clear()

View File

@ -22,6 +22,9 @@ class BasicCacheAPITest:
self.cache.delentry(100)
py.test.raises(KeyError, "self.cache.delentry(100, raising=True)")
def test_clear(self):
self.cache.clear()
class TestBuildcostAccess(BasicCacheAPITest):
cache = cacheutil.BuildcostAccessCache(maxentries=128)

View File

@ -13,22 +13,6 @@ class TestSvnURLCommandPath(CommonSvnTests):
def test_load(self, path1):
super(TestSvnURLCommandPath, self).test_load(path1)
def test_move_file(self, path1): # overrides base class
p = path1.ensure('origfile')
newp = p.dirpath('newfile')
p.move(newp)
assert newp.check(file=1)
newp.remove()
assert not p.check()
def test_move_dir(self, path1): # overrides base class
p = path1.ensure('origdir', dir=1)
newp = p.dirpath('newdir')
p.move(newp)
assert newp.check(dir=1)
newp.remove()
assert not p.check()
def test_svnurl_needs_arg(self, path1):
py.test.raises(TypeError, "py.path.svnurl()")

View File

@ -28,18 +28,6 @@ def pytest_funcarg__path1(request):
return wc
class TestWCSvnCommandPath(CommonSvnTests):
def test_move_file(self, path1): # overrides base class
try:
super(TestWCSvnCommandPath, self).test_move_file(path1)
finally:
path1.revert(rec=1)
def test_move_directory(self, path1): # overrides base class
try:
super(TestWCSvnCommandPath, self).test_move_directory(path1)
finally:
path1.revert(rec=1)
def test_status_attributes_simple(self, path1):
def assert_nochange(p):
s = p.status()