tests: allow running doctests selectively on Python 3
authorYuya Nishihara <yuya@tcha.org>
Wed, 08 Mar 2017 22:13:32 +0900
changeset 31438 82350f7fa56c
parent 31437 084050d76e4f
child 31439 b70407bd84d5
tests: allow running doctests selectively on Python 3 Currently most doctests fail on Python 3, but I want to add some.
tests/test-doctest.py
--- 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: