tests: allow running doctests selectively on Python 3
Currently most doctests fail on Python 3, but I want to add some.
--- 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: