This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: doctest.DocTestSuite doesn't handle test globs correctly
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: doctest.DocTestCase fails when run repeatedly
View: 2604
Assigned To: Nosy List: JelleZijlstra, eric.araujo, hltbra, j1m, mgedmin, python-dev
Priority: normal Keywords: patch

Created on 2010-09-01 19:01 by j1m, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit j1m, 2010-09-01 19:01
issue9736_doctestsuite_test.patch hltbra, 2012-07-20 19:00 review
Pull Requests
URL Status Linked Edit
PR 31932 merged python-dev, 2022-03-16 13:35
Messages (6)
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?
msg415465 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2022-03-18 01:59
Date User Action Args
2022-04-11 14:57:06adminsetgithub: 53945
2022-03-18 01:59:38JelleZijlstrasetstatus: open -> closed

superseder: doctest.DocTestCase fails when run repeatedly

nosy: + JelleZijlstra
messages: + msg415465
resolution: duplicate
stage: patch review -> resolved
2022-03-16 13:35:32python-devsetnosy: + python-dev

pull_requests: + pull_request30024
stage: needs patch -> patch review
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