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 benjamin.peterson
Recipients benjamin.peterson, brett.cannon
Date 2008-08-20.22:05:31
SpamBayes Score 3.249717e-11
Marked as misclassified No
Message-id <1afaf6160808201505t73fbfb0dk2e185baf5b39e1ac@mail.gmail.com>
In-reply-to <bbaeab100808201503j761acdeau9136d9b7f2bca80c@mail.gmail.com>
Content
On Wed, Aug 20, 2008 at 5:03 PM, Brett Cannon <report@bugs.python.org> 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 <report@bugs.python.org>
> <http://bugs.python.org/issue3602>
> _______________________________________
>
History
Date User Action Args
2008-08-20 22:05:32benjamin.petersonsetrecipients: + benjamin.peterson, brett.cannon
2008-08-20 22:05:31benjamin.petersonlinkissue3602 messages
2008-08-20 22:05:31benjamin.petersoncreate