##// END OF EJS Templates
py3: rewrite stdout hack of doctest by using ui.pushbuffer()...
Yuya Nishihara -
r34256:d6af8da4 default
parent child Browse files
Show More
@@ -45,9 +45,12 b' Doctest helper:'
45 ... import sys
45 ... import sys
46 ... from . import ui as uimod
46 ... from . import ui as uimod
47 ... ui = uimod.ui()
47 ... ui = uimod.ui()
48 ... ui.fout = sys.stdout # redirect to doctest
49 ... ui.verbose = verbose
48 ... ui.verbose = verbose
49 ... ui.pushbuffer()
50 ... try:
50 ... return fn(ui, ui.formatter(fn.__name__, opts))
51 ... return fn(ui, ui.formatter(fn.__name__, opts))
52 ... finally:
53 ... print(pycompat.sysstr(ui.popbuffer()), end='')
51
54
52 Basic example:
55 Basic example:
53
56
@@ -101,7 +104,7 b' bar'
101 baz: foo, bar
104 baz: foo, bar
102 """
105 """
103
106
104 from __future__ import absolute_import
107 from __future__ import absolute_import, print_function
105
108
106 import collections
109 import collections
107 import contextlib
110 import contextlib
General Comments 0
You need to be logged in to leave comments. Login now