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.

Author belopolsky
Recipients LambertDW, belopolsky, dalloliogm, rhettinger, tim.peters
Date 2009-01-13.23:15:53
SpamBayes Score 0.0785585
Marked as misclassified No
Message-id <>
The OP's problem, i.e. the need to reimport modules in every docstring 
can  easily be addressed by injecting the necessary names using 
extraglobs argument to doctest.testmod().

I like the following trick:

def getextraglobs():
   import StringIO, tempfile, ...
   return locals()

This however does not solve a problem of cleanup after examples and some 
way to specify a tearDown fixture would be helpful, particularly because  
cleanup code in examples will rarely improve documentation.
Date User Action Args
2009-01-13 23:15:54belopolskysetrecipients: + belopolsky, tim.peters, rhettinger, LambertDW, dalloliogm
2009-01-13 23:15:54belopolskysetmessageid: <>
2009-01-13 23:15:54belopolskylinkissue4899 messages
2009-01-13 23:15:53belopolskycreate