[Python-checkins] cpython (merge 3.4 -> default): Merge for issue #22191 fix

brett.cannon python-checkins at python.org
Fri Aug 22 16:46:20 CEST 2014


http://hg.python.org/cpython/rev/aeb5fc7a9956
changeset:   92180:aeb5fc7a9956
parent:      92178:a21ddb1c41d2
parent:      92179:a77dc87a34ff
user:        Brett Cannon <brett at python.org>
date:        Fri Aug 22 10:46:07 2014 -0400
summary:
  Merge for issue #22191 fix

files:
  Lib/test/test_warnings.py |  19 +++++++++++++++++++
  Lib/warnings.py           |   3 ++-
  Misc/ACKS                 |   1 +
  3 files changed, 22 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
@@ -1063,6 +1063,7 @@
 Jean-François Piéronne
 Oleg Plakhotnyuk
 Remi Pointel
+Jon Poler
 Ariel Poliak
 Guilherme Polo
 Illia Polosukhin

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list