I have been using doctest for a while and just recently started using the logging module. Each works fine separately, but they don't seem to play nice together. It looks like doctest hijacks sys.stdout to do its thing. My logger prints to the screen if not in batch and to a file if it is, so for the doctest I am running interactively, the logger output goes to logging.StreamHandler(). Other parts of the code still write to sys.stdout.
What happens is that doctest appears to continue to work on sys.stdout, but ignores the logging output. The logging output prints to the screen even when the doctest runs correctly. I really would like to have these two output streams merged just like they are when I run the script directly, and have doctest compare the merged output. My guess is that there is probably a way to do this?
Similarly, if I sent everything to the logger, what would I have to do to get doctest to work on the logging output stream?