##// END OF EJS Templates
py3: byteify test-storage.py...
Gregory Szorc -
r39989:a3a9b93b default
parent child Browse files
Show More
@@ -1,46 +1,46 b''
1 # This test verifies the conformance of various classes to various
1 # This test verifies the conformance of various classes to various
2 # storage interfaces.
2 # storage interfaces.
3 from __future__ import absolute_import
3 from __future__ import absolute_import
4
4
5 import silenttestrunner
5 import silenttestrunner
6
6
7 from mercurial import (
7 from mercurial import (
8 filelog,
8 filelog,
9 transaction,
9 transaction,
10 ui as uimod,
10 ui as uimod,
11 vfs as vfsmod,
11 vfs as vfsmod,
12 )
12 )
13
13
14 from mercurial.testing import (
14 from mercurial.testing import (
15 storage as storagetesting,
15 storage as storagetesting,
16 )
16 )
17
17
18 STATE = {
18 STATE = {
19 'lastindex': 0,
19 'lastindex': 0,
20 'ui': uimod.ui(),
20 'ui': uimod.ui(),
21 'vfs': vfsmod.vfs(b'.', realpath=True),
21 'vfs': vfsmod.vfs(b'.', realpath=True),
22 }
22 }
23
23
24 def makefilefn(self):
24 def makefilefn(self):
25 """Factory for filelog instances."""
25 """Factory for filelog instances."""
26 fl = filelog.filelog(STATE['vfs'], 'filelog-%d' % STATE['lastindex'])
26 fl = filelog.filelog(STATE['vfs'], b'filelog-%d' % STATE['lastindex'])
27 STATE['lastindex'] += 1
27 STATE['lastindex'] += 1
28 return fl
28 return fl
29
29
30 def maketransaction(self):
30 def maketransaction(self):
31 vfsmap = {'plain': STATE['vfs']}
31 vfsmap = {'plain': STATE['vfs']}
32
32
33 return transaction.transaction(STATE['ui'].warn, STATE['vfs'], vfsmap,
33 return transaction.transaction(STATE['ui'].warn, STATE['vfs'], vfsmap,
34 'journal', 'undo')
34 b'journal', b'undo')
35
35
36 # Assigning module-level attributes that inherit from unittest.TestCase
36 # Assigning module-level attributes that inherit from unittest.TestCase
37 # is all that is needed to register tests.
37 # is all that is needed to register tests.
38 filelogindextests = storagetesting.makeifileindextests(makefilefn,
38 filelogindextests = storagetesting.makeifileindextests(makefilefn,
39 maketransaction)
39 maketransaction)
40 filelogdatatests = storagetesting.makeifiledatatests(makefilefn,
40 filelogdatatests = storagetesting.makeifiledatatests(makefilefn,
41 maketransaction)
41 maketransaction)
42 filelogmutationtests = storagetesting.makeifilemutationtests(makefilefn,
42 filelogmutationtests = storagetesting.makeifilemutationtests(makefilefn,
43 maketransaction)
43 maketransaction)
44
44
45 if __name__ == '__main__':
45 if __name__ == '__main__':
46 silenttestrunner.main(__name__)
46 silenttestrunner.main(__name__)
General Comments 0
You need to be logged in to leave comments. Login now