tests/test-doctest.py
changeset 34424 e416819d9ebb
parent 34362 b76937fafe8a
child 35169 898c6f812a51
equal deleted inserted replaced
34423:1baa077214ae 34424:e416819d9ebb
    22                       got2, re.MULTILINE)
    22                       got2, re.MULTILINE)
    23         got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE)
    23         got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE)
    24         return any(doctest.OutputChecker.check_output(self, w, g, optionflags)
    24         return any(doctest.OutputChecker.check_output(self, w, g, optionflags)
    25                    for w, g in [(want, got), (want2, got2)])
    25                    for w, g in [(want, got), (want2, got2)])
    26 
    26 
    27 # TODO: migrate doctests to py3 and enable them on both versions
    27 def testmod(name, optionflags=0, testtarget=None):
    28 def testmod(name, optionflags=0, testtarget=None, py2=True, py3=True):
       
    29     if not (not ispy3 and py2 or ispy3 and py3):
       
    30         return
       
    31     __import__(name)
    28     __import__(name)
    32     mod = sys.modules[name]
    29     mod = sys.modules[name]
    33     if testtarget is not None:
    30     if testtarget is not None:
    34         mod = getattr(mod, testtarget)
    31         mod = getattr(mod, testtarget)
    35 
    32