changeset 34141:9b4d7d4855f5

doctest: enable tests by default on Python 3 Still several tests fail mostly because of the string issues, sigh. I'll fix them one by one.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Sep 2017 15:09:04 +0900
parents 52ec9ac0303b
children 24bf823377fc
files tests/test-doctest.py
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-doctest.py	Thu Aug 24 22:33:28 2017 +0900
+++ b/tests/test-doctest.py	Sun Sep 03 15:09:04 2017 +0900
@@ -25,7 +25,7 @@
                    for w, g in [(want, got), (want2, got2)])
 
 # TODO: migrate doctests to py3 and enable them on both versions
-def testmod(name, optionflags=0, testtarget=None, py2=True, py3=False):
+def testmod(name, optionflags=0, testtarget=None, py2=True, py3=True):
     if not (not ispy3 and py2 or ispy3 and py3):
         return
     __import__(name)
@@ -48,30 +48,31 @@
 testmod('mercurial.color')
 testmod('mercurial.config')
 testmod('mercurial.context')
-testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
+testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE,
+        py3=False)  # py3: use of str()
 testmod('mercurial.dispatch')
-testmod('mercurial.encoding')
-testmod('mercurial.formatter')
+testmod('mercurial.encoding', py3=False)  # py3: multiple encoding issues
+testmod('mercurial.formatter', py3=False)  # py3: write bytes to stdout
 testmod('mercurial.hg')
-testmod('mercurial.hgweb.hgwebdir_mod')
+testmod('mercurial.hgweb.hgwebdir_mod', py3=False)  # py3: repr(bytes) ?
 testmod('mercurial.match')
 testmod('mercurial.mdiff')
 testmod('mercurial.minirst')
-testmod('mercurial.patch')
-testmod('mercurial.pathutil')
+testmod('mercurial.patch', py3=False)  # py3: bytes[n], etc. ?
+testmod('mercurial.pathutil', py3=False)  # py3: os.sep
 testmod('mercurial.parser')
-testmod('mercurial.pycompat', py3=True)
+testmod('mercurial.pycompat')
 testmod('mercurial.revsetlang')
 testmod('mercurial.smartset')
-testmod('mercurial.store')
+testmod('mercurial.store', py3=False)  # py3: bytes[n]
 testmod('mercurial.subrepo')
 testmod('mercurial.templatefilters')
 testmod('mercurial.templater')
-testmod('mercurial.ui')
+testmod('mercurial.ui', py3=False)  # py3: __name__
 testmod('mercurial.url')
-testmod('mercurial.util')
+testmod('mercurial.util', py3=False)  # py3: multiple bytes/unicode issues
 testmod('mercurial.util', testtarget='platform')
-testmod('hgext.convert.convcmd')
+testmod('hgext.convert.convcmd', py3=False)  # py3: use of str() ?
 testmod('hgext.convert.cvsps')
 testmod('hgext.convert.filemap')
 testmod('hgext.convert.p4')