Title: doctest.DocTestSuite doesn't handle test globs correctly
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, hltbra, j1m, mgedmin
Priority: normal Keywords: patch

Created on 2010-09-01 19:01 by j1m, last changed 2013-05-29 14:09 by mgedmin.

File name Uploaded Description Edit j1m, 2010-09-01 19:01
issue9736_doctestsuite_test.patch hltbra, 2012-07-20 19:00 review
Messages (5)
msg115326 - (view) Author: Jim Fulton (j1m) * (Python committer) Date: 2010-09-01 19:01
We often run test suites repeatedly using a debug build of python
to look for memory leaks.

We also got in the bad habit of using a fork of doctest. Recently, we've switched away from our fork and have noticed a problem with the standard doctest's handling of test globs (globals).

DocTestSuite gets an initial set of globals from the module the doctest's came from.  After running the tests, it seems to clear these, leading to errors if the tests are run again.

I've attached a script that illustrates the problem.  The script runs a simple test twice and gets a spurious failure the second time.
msg120260 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-02 21:55
Would you like to work on a patch?

(Setting the versions field to versions that are open for bug fixes.)
msg120277 - (view) Author: Jim Fulton (j1m) * (Python committer) Date: 2010-11-02 22:52
On Tue, Nov 2, 2010 at 5:55 PM, Éric Araujo <> wrote:
> Éric Araujo <> added the comment:
> Would you like to work on a patch?


msg165969 - (view) Author: Hugo Lopes Tavares (hltbra) Date: 2012-07-20 19:00
I see the bug was not fixed yet, and I started to investigate it.

I am attaching a test patch. I don't know if I will get it working soon, since I see it as a very low priority for Python.
msg190309 - (view) Author: Marius Gedminas (mgedmin) * Date: 2013-05-29 14:09
This is a duplicate of issue2604, isn't it?
Date User Action Args
2013-05-29 14:09:59mgedminsetnosy: + mgedmin
messages: + msg190309
2012-07-20 19:00:10hltbrasetfiles: + issue9736_doctestsuite_test.patch
versions: + Python 3.3, Python 3.4, - Python 3.1, Python 3.2
nosy: + hltbra

messages: + msg165969

keywords: + patch
2010-11-02 22:52:29j1msetmessages: + msg120277
2010-11-02 21:55:05eric.araujosetversions: + Python 3.2, - Python 2.6, Python 2.5
nosy: + eric.araujo

messages: + msg120260

type: behavior
stage: needs patch
2010-09-01 19:01:13j1mcreate