Mercurial > hg
view tests/test-storage.py @ 40038:906c95073ff7
treemanifests: extract _loaddifflazy from _diff, use in _filesnotin
Differential Revision: https://phab.mercurial-scm.org/D4873
author | spectral <spectral@google.com> |
---|---|
date | Tue, 02 Oct 2018 18:55:07 -0700 |
parents | a3a9b93bff80 |
children | cdf61ab1f54c |
line wrap: on
line source
# This test verifies the conformance of various classes to various # storage interfaces. from __future__ import absolute_import import silenttestrunner from mercurial import ( filelog, transaction, ui as uimod, vfs as vfsmod, ) from mercurial.testing import ( storage as storagetesting, ) STATE = { 'lastindex': 0, 'ui': uimod.ui(), 'vfs': vfsmod.vfs(b'.', realpath=True), } def makefilefn(self): """Factory for filelog instances.""" fl = filelog.filelog(STATE['vfs'], b'filelog-%d' % STATE['lastindex']) STATE['lastindex'] += 1 return fl def maketransaction(self): vfsmap = {'plain': STATE['vfs']} return transaction.transaction(STATE['ui'].warn, STATE['vfs'], vfsmap, b'journal', b'undo') # Assigning module-level attributes that inherit from unittest.TestCase # is all that is needed to register tests. filelogindextests = storagetesting.makeifileindextests(makefilefn, maketransaction) filelogdatatests = storagetesting.makeifiledatatests(makefilefn, maketransaction) filelogmutationtests = storagetesting.makeifilemutationtests(makefilefn, maketransaction) if __name__ == '__main__': silenttestrunner.main(__name__)