Show More
@@ -1,46 +1,52 | |||||
1 | # this is hack to make sure no escape characters are inserted into the output |
|
1 | # this is hack to make sure no escape characters are inserted into the output | |
2 |
|
2 | |||
3 | from __future__ import absolute_import |
|
3 | from __future__ import absolute_import | |
4 |
|
4 | |||
5 | import doctest |
|
5 | import doctest | |
6 | import os |
|
6 | import os | |
7 | import sys |
|
7 | import sys | |
|
8 | ||||
|
9 | ispy3 = (sys.version_info[0] >= 3) | |||
|
10 | ||||
8 | if 'TERM' in os.environ: |
|
11 | if 'TERM' in os.environ: | |
9 | del os.environ['TERM'] |
|
12 | del os.environ['TERM'] | |
10 |
|
13 | |||
11 | def testmod(name, optionflags=0, testtarget=None): |
|
14 | # TODO: migrate doctests to py3 and enable them on both versions | |
|
15 | def testmod(name, optionflags=0, testtarget=None, py2=True, py3=False): | |||
|
16 | if not (not ispy3 and py2 or ispy3 and py3): | |||
|
17 | return | |||
12 | __import__(name) |
|
18 | __import__(name) | |
13 | mod = sys.modules[name] |
|
19 | mod = sys.modules[name] | |
14 | if testtarget is not None: |
|
20 | if testtarget is not None: | |
15 | mod = getattr(mod, testtarget) |
|
21 | mod = getattr(mod, testtarget) | |
16 | doctest.testmod(mod, optionflags=optionflags) |
|
22 | doctest.testmod(mod, optionflags=optionflags) | |
17 |
|
23 | |||
18 | testmod('mercurial.changegroup') |
|
24 | testmod('mercurial.changegroup') | |
19 | testmod('mercurial.changelog') |
|
25 | testmod('mercurial.changelog') | |
20 | testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE) |
|
26 | testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE) | |
21 | testmod('mercurial.dispatch') |
|
27 | testmod('mercurial.dispatch') | |
22 | testmod('mercurial.encoding') |
|
28 | testmod('mercurial.encoding') | |
23 | testmod('mercurial.formatter') |
|
29 | testmod('mercurial.formatter') | |
24 | testmod('mercurial.hg') |
|
30 | testmod('mercurial.hg') | |
25 | testmod('mercurial.hgweb.hgwebdir_mod') |
|
31 | testmod('mercurial.hgweb.hgwebdir_mod') | |
26 | testmod('mercurial.match') |
|
32 | testmod('mercurial.match') | |
27 | testmod('mercurial.minirst') |
|
33 | testmod('mercurial.minirst') | |
28 | testmod('mercurial.patch') |
|
34 | testmod('mercurial.patch') | |
29 | testmod('mercurial.pathutil') |
|
35 | testmod('mercurial.pathutil') | |
30 | testmod('mercurial.parser') |
|
36 | testmod('mercurial.parser') | |
31 | testmod('mercurial.revsetlang') |
|
37 | testmod('mercurial.revsetlang') | |
32 | testmod('mercurial.smartset') |
|
38 | testmod('mercurial.smartset') | |
33 | testmod('mercurial.store') |
|
39 | testmod('mercurial.store') | |
34 | testmod('mercurial.subrepo') |
|
40 | testmod('mercurial.subrepo') | |
35 | testmod('mercurial.templatefilters') |
|
41 | testmod('mercurial.templatefilters') | |
36 | testmod('mercurial.templater') |
|
42 | testmod('mercurial.templater') | |
37 | testmod('mercurial.ui') |
|
43 | testmod('mercurial.ui') | |
38 | testmod('mercurial.url') |
|
44 | testmod('mercurial.url') | |
39 | testmod('mercurial.util') |
|
45 | testmod('mercurial.util') | |
40 | testmod('mercurial.util', testtarget='platform') |
|
46 | testmod('mercurial.util', testtarget='platform') | |
41 | testmod('hgext.convert.convcmd') |
|
47 | testmod('hgext.convert.convcmd') | |
42 | testmod('hgext.convert.cvsps') |
|
48 | testmod('hgext.convert.cvsps') | |
43 | testmod('hgext.convert.filemap') |
|
49 | testmod('hgext.convert.filemap') | |
44 | testmod('hgext.convert.p4') |
|
50 | testmod('hgext.convert.p4') | |
45 | testmod('hgext.convert.subversion') |
|
51 | testmod('hgext.convert.subversion') | |
46 | testmod('hgext.mq') |
|
52 | testmod('hgext.mq') |
General Comments 0
You need to be logged in to leave comments.
Login now