# HG changeset patch # User Yuya Nishihara # Date 1488978812 -32400 # Node ID 82350f7fa56ccb07f8c992e3e1e4e8b06d4c4e2b # Parent 084050d76e4f23ddcfc8cb0d2e2416b4e8a13309 tests: allow running doctests selectively on Python 3 Currently most doctests fail on Python 3, but I want to add some. diff -r 084050d76e4f -r 82350f7fa56c 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: