##// END OF EJS Templates
tests: add `revlogutils.deltas` module to doctests...
Boris Feld -
r40676:a3183ca7 default
parent child Browse files
Show More
@@ -1,83 +1,84 b''
1 1 # this is hack to make sure no escape characters are inserted into the output
2 2
3 3 from __future__ import absolute_import
4 4
5 5 import doctest
6 6 import os
7 7 import re
8 8 import sys
9 9
10 10 ispy3 = (sys.version_info[0] >= 3)
11 11
12 12 if 'TERM' in os.environ:
13 13 del os.environ['TERM']
14 14
15 15 class py3docchecker(doctest.OutputChecker):
16 16 def check_output(self, want, got, optionflags):
17 17 want2 = re.sub(r'''\bu(['"])(.*?)\1''', r'\1\2\1', want) # py2: u''
18 18 got2 = re.sub(r'''\bb(['"])(.*?)\1''', r'\1\2\1', got) # py3: b''
19 19 # py3: <exc.name>: b'<msg>' -> <name>: <msg>
20 20 # <exc.name>: <others> -> <name>: <others>
21 21 got2 = re.sub(r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''', r'\1: \3',
22 22 got2, re.MULTILINE)
23 23 got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE)
24 24 return any(doctest.OutputChecker.check_output(self, w, g, optionflags)
25 25 for w, g in [(want, got), (want2, got2)])
26 26
27 27 def testmod(name, optionflags=0, testtarget=None):
28 28 __import__(name)
29 29 mod = sys.modules[name]
30 30 if testtarget is not None:
31 31 mod = getattr(mod, testtarget)
32 32
33 33 # minimal copy of doctest.testmod()
34 34 finder = doctest.DocTestFinder()
35 35 checker = None
36 36 if ispy3:
37 37 checker = py3docchecker()
38 38 runner = doctest.DocTestRunner(checker=checker, optionflags=optionflags)
39 39 for test in finder.find(mod, name):
40 40 runner.run(test)
41 41 runner.summarize()
42 42
43 43 testmod('mercurial.changegroup')
44 44 testmod('mercurial.changelog')
45 45 testmod('mercurial.cmdutil')
46 46 testmod('mercurial.color')
47 47 testmod('mercurial.config')
48 48 testmod('mercurial.context')
49 49 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
50 50 testmod('mercurial.dispatch')
51 51 testmod('mercurial.encoding')
52 52 testmod('mercurial.fancyopts')
53 53 testmod('mercurial.formatter')
54 54 testmod('mercurial.hg')
55 55 testmod('mercurial.hgweb.hgwebdir_mod')
56 56 testmod('mercurial.match')
57 57 testmod('mercurial.mdiff')
58 58 testmod('mercurial.minirst')
59 59 testmod('mercurial.patch')
60 60 testmod('mercurial.pathutil')
61 61 testmod('mercurial.parser')
62 62 testmod('mercurial.pycompat')
63 63 testmod('mercurial.revlog')
64 testmod('mercurial.revlogutils.deltas')
64 65 testmod('mercurial.revsetlang')
65 66 testmod('mercurial.smartset')
66 67 testmod('mercurial.store')
67 68 testmod('mercurial.subrepo')
68 69 testmod('mercurial.templatefilters')
69 70 testmod('mercurial.templater')
70 71 testmod('mercurial.ui')
71 72 testmod('mercurial.url')
72 73 testmod('mercurial.util')
73 74 testmod('mercurial.util', testtarget='platform')
74 75 testmod('mercurial.utils.stringutil')
75 76 testmod('hgext.convert.convcmd')
76 77 testmod('hgext.convert.cvsps')
77 78 testmod('hgext.convert.filemap')
78 79 testmod('hgext.convert.p4')
79 80 testmod('hgext.convert.subversion')
80 81 testmod('hgext.fix')
81 82 testmod('hgext.mq')
82 83 # Helper scripts in tests/ that have doctests:
83 84 testmod('drawdag')
General Comments 0
You need to be logged in to leave comments. Login now