]> granicus.if.org Git - python/commitdiff
bpo-33509: Fix test_warnings for python3 -Werror (GH-7365)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 4 Jun 2018 17:23:41 +0000 (10:23 -0700)
committerGitHub <noreply@github.com>
Mon, 4 Jun 2018 17:23:41 +0000 (10:23 -0700)
Fix test_warnings.test_module_globals() when python3 is run with
-Werror.
(cherry picked from commit e292b75e3ecdc6bbe81cda09de836dc9e27ab9e6)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/test/test_warnings/__init__.py

index 940db5c143c930cdaa3b6f3c57e08e9c913c8052..b48debd31fa841f990bfa2bcaa8c934e2ec3cc1a 100644 (file)
@@ -221,6 +221,8 @@ class FilterTests(BaseTest):
     def test_module_globals(self):
         with original_warnings.catch_warnings(record=True,
                 module=self.module) as w:
+            self.module.simplefilter("always", UserWarning)
+
             # bpo-33509: module_globals=None must not crash
             self.module.warn_explicit('msg', UserWarning, "filename", 42,
                                       module_globals=None)