[Python-checkins] cpython (3.4): Issue #22191: Fix warnings.__all__.
brett.cannon
python-checkins at python.org
Fri Aug 22 16:46:19 CEST 2014
http://hg.python.org/cpython/rev/a77dc87a34ff
changeset: 92179:a77dc87a34ff
branch: 3.4
parent: 92176:48a77fbfd6cb
user: Brett Cannon <brett at python.org>
date: Fri Aug 22 10:44:47 2014 -0400
summary:
Issue #22191: Fix warnings.__all__.
Thanks to Jon Poler for the patch.
files:
Lib/test/test_warnings.py | 19 +++++++++++++++++++
Lib/warnings.py | 3 ++-
Misc/ACKS | 1 +
Misc/NEWS | 2 ++
4 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -61,6 +61,25 @@
sys.modules['warnings'] = original_warnings
super(BaseTest, self).tearDown()
+class PublicAPITests(BaseTest):
+
+ """Ensures that the correct values are exposed in the
+ public API.
+ """
+
+ def test_module_all_attribute(self):
+ self.assertTrue(hasattr(self.module, '__all__'))
+ target_api = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
+ "resetwarnings", "catch_warnings"]
+ self.assertSetEqual(set(self.module.__all__),
+ set(target_api))
+
+class CPublicAPITests(PublicAPITests, unittest.TestCase):
+ module = c_warnings
+
+class PyPublicAPITests(PublicAPITests, unittest.TestCase):
+ module = py_warnings
class FilterTests(BaseTest):
diff --git a/Lib/warnings.py b/Lib/warnings.py
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -2,7 +2,8 @@
import sys
-__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
+__all__ = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1054,6 +1054,7 @@
Jean-François Piéronne
Oleg Plakhotnyuk
Remi Pointel
+Jon Poler
Ariel Poliak
Guilherme Polo
Illia Polosukhin
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@
Library
-------
+-- Issue #22191: Fix warnings.__all__.
+
- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows.
- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list