tests: fix fastmanifest tests

Changing the config defaults to be part of the config registrar caused the unit
tests to fail (since they don't load the registrar).
This commit is contained in:
Durham Goode 2017-10-23 20:13:13 -07:00
parent f260c80298
commit 29bb657526
2 changed files with 9 additions and 5 deletions

View File

@ -49,7 +49,7 @@ class hybridmanifest(object):
self.__flatmanifest = flat self.__flatmanifest = flat
self.loadflat = loadflat self.loadflat = loadflat
if supportsctree and ui.configbool("fastmanifest", "usetree", False): if supportsctree and ui.configbool("fastmanifest", "usetree"):
self.__treemanifest = tree self.__treemanifest = tree
else: else:
self.__treemanifest = False self.__treemanifest = False
@ -949,8 +949,8 @@ class manifestfactory(object):
p1text = None p1text = None
p1hexnode = revlog.hex(p1) p1hexnode = revlog.hex(p1)
cacheenabled = self.ui.configbool("fastmanifest", "usecache") cacheenabled = self.ui.configbool("fastmanifest", "usecache", True)
treeenabled = self.ui.configbool("fastmanifest", "usetree") treeenabled = self.ui.configbool("fastmanifest", "usetree", False)
if (cacheenabled and if (cacheenabled and
p1hexnode in fastcache and p1hexnode in fastcache and

View File

@ -63,7 +63,9 @@ class HybridManifest(unittest.TestCase):
""" """
vfs = vfsmod.vfs(os.getcwd()) vfs = vfsmod.vfs(os.getcwd())
hd = fastmanifest.implementation.hybridmanifest(ui.ui(), vfs, None, tempui = ui.ui()
tempui.setconfig("fastmanifest", "usecache", True)
hd = fastmanifest.implementation.hybridmanifest(tempui, vfs, None,
fast=True) fast=True)
ismagic = lambda x: x.startswith("__") and x.endswith("__") ismagic = lambda x: x.startswith("__") and x.endswith("__")
magicmethods = [k magicmethods = [k
@ -105,8 +107,10 @@ class HybridManifest(unittest.TestCase):
"""We mock the ondisk cache and test that the two layers of cache """We mock the ondisk cache and test that the two layers of cache
work properly""" work properly"""
vfs = vfsmod.vfs(os.getcwd()) vfs = vfsmod.vfs(os.getcwd())
tempui = ui.ui()
tempui.setconfig("fastmanifest", "usecache", True)
cache = fastmanifest.implementation.fastmanifestcache(vfs, cache = fastmanifest.implementation.fastmanifestcache(vfs,
ui.ui(), None) tempui, None)
ondiskcache = mockondiskcache() ondiskcache = mockondiskcache()
cache.ondiskcache = ondiskcache cache.ondiskcache = ondiskcache
# Test 1) Put one manifest in the cache, check that retrieving it does # Test 1) Put one manifest in the cache, check that retrieving it does