Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Wed, Aug 20, 2008 at 5:03 PM, Brett Cannon <[EMAIL PROTECTED]> wrote: > > Well, the bulk of the code needs to live in 'warnings' for it to exist > if the 'test' package is missing. So any differences need to come from > the test.support version. Now the module argument is so that you can > control exactly what module has its showwarnings() implementation > changed without worrying about what 'warnings' is set in sys.modules > and really mucking up the interpreter. But if this argument is missing > then warnings.catchwarnings() will have to set warnings.showwarnings() > blindly since it doesn't know what module object is being tested. So > if I want that change to happen on another module, I need to change > what module is in sys.modules, call the context manager, and then put > it all back so that what I want happen occurs.
Alternatively, you could just have another copy of catch_warning in test_warnings with the extra argument. > > That's why you would have to mess with sys.modules. =) The argument > could be renamed '_using', but that just seems silly. And with it > being considered keyword-only (and I will make it the last argument > listed, then most people won't ever run into it. > > _______________________________________ > Python tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue3602> > _______________________________________ > _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3602> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com