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 DocFileCase setUp/tearDown asymmetry
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
Status: closed Resolution: duplicate
Dependencies: Superseder: doctest.DocTestCase fails when run repeatedly
View: 2604
Assigned To: Nosy List: boogenhagn, fdrake, mgedmin
Priority: normal Keywords:

Created on 2010-07-21 22:08 by boogenhagn, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit boogenhagn, 2010-07-21 22:30 demonstration of the issue
Messages (2)
msg111127 - (view) Author: Patrick Strawderman (boogenhagn) Date: 2010-07-21 22:08
doctest.DocFileTest inserts the test's path into the globs as "__file__",
but doctest.DocTestCase's tearDown method simply calls globs.clear(),
so that subsequent runs of the test case will not receive the same
initial globals.

This means that doctests referencing __file__ cannot be run repeatedly
without using a custom setUp that restores __file__.

I think most would expect symmetry between setUp and tearDown, and in
fact zope.testrunner operates with this false assumption when run
with the "-N" option to repeat a test N times.
msg167695 - (view) Author: Marius Gedminas (mgedmin) * Date: 2012-08-08 16:38
Duplicate of issue2604?
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53573
2016-05-28 20:44:12berker.peksagsetstatus: open -> closed
superseder: doctest.DocTestCase fails when run repeatedly
resolution: duplicate
stage: resolved
2012-08-08 16:38:52mgedminsetnosy: + mgedmin
messages: + msg167695
2010-07-21 22:30:59boogenhagnsetfiles: +
2010-07-21 22:30:37boogenhagnsetfiles: -
2010-07-21 22:30:34boogenhagnsetfiles: -
2010-07-21 22:11:59boogenhagnsetversions: - Python 3.3
2010-07-21 22:10:59boogenhagnsetfiles: +
2010-07-21 22:09:43boogenhagnsetfiles: +
2010-07-21 22:08:35boogenhagncreate