Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'u/vbraun/python_3_print_in_doctests' in 8.1.b1
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed Aug 6, 2017
2 parents e77531e + f640131 commit fb09ba9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sage/doctest/forker.py
Expand Up @@ -35,6 +35,7 @@

from __future__ import print_function
from __future__ import absolute_import
import __future__

import hashlib, multiprocessing, os, sys, time, warnings, signal, linecache
import doctest, traceback
Expand All @@ -45,7 +46,11 @@
from .parsing import OriginalSource, reduce_hex
from sage.structure.sage_object import SageObject
from .parsing import SageOutputChecker, pre_hash, get_source
from sage.repl.user_globals import set_globals
from sage.repl.user_globals import set_globals, get_globals


# All doctests run as if the following future imports are present
MANDATORY_COMPILE_FLAGS = __future__.print_function.compiler_flag


def init_sage():
Expand Down Expand Up @@ -130,6 +135,7 @@ def init_sage():
stringPict.terminal_width = lambda self:0



def showwarning_with_traceback(message, category, filename, lineno, file=sys.stdout, line=None):
r"""
Displays a warning message with a traceback.
Expand Down Expand Up @@ -624,6 +630,7 @@ def run(self, test, compileflags=None, out=None, clear_globs=True):
self.test = test
if compileflags is None:
compileflags = doctest._extract_future_flags(test.globs)
compileflags |= MANDATORY_COMPILE_FLAGS
# We use this slightly modified version of Pdb because it
# interacts better with the doctesting framework (like allowing
# doctests for sys.settrace()). Since we already have output
Expand Down

0 comments on commit fb09ba9

Please sign in to comment.