changeset 31447:82350f7fa56c

tests: allow running doctests selectively on Python 3 Currently most doctests fail on Python 3, but I want to add some.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 08 Mar 2017 22:13:32 +0900
parents 084050d76e4f
children b70407bd84d5
files tests/test-doctest.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-doctest.py	Wed Mar 15 15:33:24 2017 -0700
+++ b/tests/test-doctest.py	Wed Mar 08 22:13:32 2017 +0900
@@ -5,10 +5,16 @@
 import doctest
 import os
 import sys
+
+ispy3 = (sys.version_info[0] >= 3)
+
 if 'TERM' in os.environ:
     del os.environ['TERM']
 
-def testmod(name, optionflags=0, testtarget=None):
+# TODO: migrate doctests to py3 and enable them on both versions
+def testmod(name, optionflags=0, testtarget=None, py2=True, py3=False):
+    if not (not ispy3 and py2 or ispy3 and py3):
+        return
     __import__(name)
     mod = sys.modules[name]
     if testtarget is not None: