Commit a6b73f66 authored by Stefan Behnel's avatar Stefan Behnel

enable doctests in Py3 and fix them

parent 69139ead
...@@ -257,7 +257,7 @@ def parse_directive_value(name, value, relaxed_bool=False): ...@@ -257,7 +257,7 @@ def parse_directive_value(name, value, relaxed_bool=False):
Parses value as an option value for the given name and returns Parses value as an option value for the given name and returns
the interpreted value. None is returned if the option does not exist. the interpreted value. None is returned if the option does not exist.
>>> print parse_directive_value('nonexisting', 'asdf asdfd') >>> print(parse_directive_value('nonexisting', 'asdf asdfd'))
None None
>>> parse_directive_value('boundscheck', 'True') >>> parse_directive_value('boundscheck', 'True')
True True
......
...@@ -57,7 +57,7 @@ class TreeVisitor(object): ...@@ -57,7 +57,7 @@ class TreeVisitor(object):
>>> tree = SampleNode(0, SampleNode(1), [SampleNode(2), SampleNode(3)]) >>> tree = SampleNode(0, SampleNode(1), [SampleNode(2), SampleNode(3)])
>>> class MyVisitor(TreeVisitor): >>> class MyVisitor(TreeVisitor):
... def visit_SampleNode(self, node): ... def visit_SampleNode(self, node):
... print("in %s %s" % (node.value, self.access_path) ... print("in %s %s" % (node.value, self.access_path))
... self.visitchildren(node) ... self.visitchildren(node)
... print("out %s" % node.value) ... print("out %s" % node.value)
... ...
......
...@@ -79,23 +79,23 @@ at that spot and get a new StringIOTree object that is "left behind". ...@@ -79,23 +79,23 @@ at that spot and get a new StringIOTree object that is "left behind".
EXAMPLE: EXAMPLE:
>>> a = StringIOTree() >>> a = StringIOTree()
>>> a.write('first\n') >>> _= a.write('first\n')
>>> b = a.insertion_point() >>> b = a.insertion_point()
>>> a.write('third\n') >>> _= a.write('third\n')
>>> b.write('second\n') >>> _= b.write('second\n')
>>> a.getvalue().split() >>> a.getvalue().split()
['first', 'second', 'third'] ['first', 'second', 'third']
>>> c = b.insertion_point() >>> c = b.insertion_point()
>>> d = c.insertion_point() >>> d = c.insertion_point()
>>> d.write('alpha\n') >>> _= d.write('alpha\n')
>>> b.write('gamma\n') >>> _= b.write('gamma\n')
>>> c.write('beta\n') >>> _= c.write('beta\n')
>>> b.getvalue().split() >>> b.getvalue().split()
['second', 'alpha', 'beta', 'gamma'] ['second', 'alpha', 'beta', 'gamma']
>>> i = StringIOTree() >>> i = StringIOTree()
>>> d.insert(i) >>> d.insert(i)
>>> i.write('inserted\n') >>> _= i.write('inserted\n')
>>> out = StringIO() >>> out = StringIO()
>>> a.copyto(out) >>> a.copyto(out)
>>> out.getvalue().split() >>> out.getvalue().split()
......
...@@ -1303,7 +1303,7 @@ def collect_doctests(path, module_prefix, suite, selectors, exclude_selectors): ...@@ -1303,7 +1303,7 @@ def collect_doctests(path, module_prefix, suite, selectors, exclude_selectors):
def package_matches(dirname): def package_matches(dirname):
if dirname == 'Debugger' and not include_debugger: if dirname == 'Debugger' and not include_debugger:
return False return False
return dirname not in ("Mac", "Distutils", "Plex") return dirname not in ("Mac", "Distutils", "Plex", "Tempita")
def file_matches(filename): def file_matches(filename):
filename, ext = os.path.splitext(filename) filename, ext = os.path.splitext(filename)
blacklist = ['libcython', 'libpython', 'test_libcython_in_gdb', blacklist = ['libcython', 'libpython', 'test_libcython_in_gdb',
...@@ -1766,7 +1766,6 @@ def main(): ...@@ -1766,7 +1766,6 @@ def main():
WORKDIR = os.path.abspath(options.work_dir) WORKDIR = os.path.abspath(options.work_dir)
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
options.doctests = False
if options.with_cython: if options.with_cython:
sys.path.insert(0, options.cython_dir) sys.path.insert(0, options.cython_dir)
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment