On Jun 25, 2008, at 2:45 PM, Martijn Faassen wrote: > This places new key/value pairs into a dictionary, in this case > test.globs. Unfortunately when the execution results in a class > definition, it'll have its __module__ attribute set to > '__builtin__'. Try as I might, I couldn't convince exec to do it any > differently. The zope.testing package has a way to work around this from setup/ teardown functions passed to the DocFileSuite (or whatever wrapper you're using). See the module zope.testing.module for the functions. Essentially, the __name__ needs to be set in test.globs; class construction uses the global value for __name__ to provide __module__; doctests normally don't have one, so it acquires the value from __builtin__.__name__ instead. Which is, of course, horribly wrong. The solution in zope.testing.module allows the class to be used with pickle within the test as well. -Fred -- Fred Drake <fdrake at acm.org>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4