Move the DOCTEST_MODE setting to the doctesting framework, for example in the file sage/doctest/all.py.
Depends on #12415
CC: @jhpalmieri
Component: doctest framework
Author: John Palmieri
Reviewer: Volker Braun
Merged: sage-5.10.beta1
Issue created by migration from https://trac.sagemath.org/ticket/14203