[New-bugs-announce] [issue9327] doctest DocFileCase setUp/tearDown asymmetry

Patrick Strawderman report at bugs.python.org
Thu Jul 22 00:08:36 CEST 2010

New submission from Patrick Strawderman <patrick at zope.com>:

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.

components: Library (Lib)
messages: 111127
nosy: boogenhagn, fdrake
priority: normal
severity: normal
status: open
title: doctest DocFileCase setUp/tearDown asymmetry
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list