Rev 3433: remove the parameter from activate, and just have it always False in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/dep_warnings

John Arbash Meinel john at arbash-meinel.com
Thu May 29 00:13:43 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/dep_warnings

------------------------------------------------------------
revno: 3433
revision-id: john at arbash-meinel.com-20080528231330-k9ger42pvc1eiw1l
parent: john at arbash-meinel.com-20080528230834-m1qw9peoydd3koty
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Wed 2008-05-28 18:13:30 -0500
message:
  remove the parameter from activate, and just have it always False
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
  bzrlib/tests/test_symbol_versioning.py test_symbol_versioning.py-20060105104851-51d7722c2018d42b
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-05-28 21:53:46 +0000
+++ b/bzrlib/builtins.py	2008-05-28 23:13:30 +0000
@@ -2657,7 +2657,7 @@
         from bzrlib.benchmarks import tree_creator
 
         # Make deprecation warnings visible, unless -Werror is set
-        symbol_versioning.activate_deprecation_warnings(always=False)
+        symbol_versioning.activate_deprecation_warnings()
 
         if cache_dir is not None:
             tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)

=== modified file 'bzrlib/symbol_versioning.py'
--- a/bzrlib/symbol_versioning.py	2008-05-28 23:08:34 +0000
+++ b/bzrlib/symbol_versioning.py	2008-05-28 23:13:30 +0000
@@ -363,7 +363,7 @@
     warnings.filterwarnings('ignore', category=DeprecationWarning)
 
 
-def activate_deprecation_warnings(always=True):
+def activate_deprecation_warnings():
     """Call this function to activate deprecation warnings.
 
     When running in a 'final' release we suppress deprecation warnings.
@@ -373,12 +373,9 @@
     Note: warnings that have already been issued under 'ignore' will not be
     reported after this point. The 'warnings' module has already marked them as
     handled, so they don't get issued again.
-
-    :param always: If False, check warnings.filter to see if warnings are set
-        to be turned into errors. If True, then do not override with 'default'.
     """
     import warnings
-    if not always and _check_for_filter(True):
+    if _check_for_filter(True):
         # DeprecationWarnings are already turned into errors, don't downgrade
         # them to 'default'.
         return

=== modified file 'bzrlib/tests/test_symbol_versioning.py'
--- a/bzrlib/tests/test_symbol_versioning.py	2008-05-28 23:08:34 +0000
+++ b/bzrlib/tests/test_symbol_versioning.py	2008-05-28 23:13:30 +0000
@@ -249,13 +249,9 @@
         self.assertFirstWarning('ignore', DeprecationWarning)
         self.assertEqual(1, len(warnings.filters))
 
-    def test_activate_deprecation_warnings(self):
-        symbol_versioning.activate_deprecation_warnings(always=True)
-        self.assertFirstWarning('default', DeprecationWarning)
-
     def test_activate_deprecation_no_error(self):
         # First nuke the filters, so we know it is clean
-        symbol_versioning.activate_deprecation_warnings(always=False)
+        symbol_versioning.activate_deprecation_warnings()
         self.assertFirstWarning('default', DeprecationWarning)
 
     def test_activate_deprecation_with_error(self):
@@ -264,7 +260,7 @@
         warnings.filterwarnings('error', category=Warning)
         self.assertFirstWarning('error', Warning)
         self.assertEqual(1, len(warnings.filters))
-        symbol_versioning.activate_deprecation_warnings(always=False)
+        symbol_versioning.activate_deprecation_warnings()
         # There should not be a new warning
         self.assertFirstWarning('error', Warning)
         self.assertEqual(1, len(warnings.filters))
@@ -275,7 +271,7 @@
         warnings.filterwarnings('error', category=DeprecationWarning)
         self.assertFirstWarning('error', DeprecationWarning)
         self.assertEqual(1, len(warnings.filters))
-        symbol_versioning.activate_deprecation_warnings(always=False)
+        symbol_versioning.activate_deprecation_warnings()
         # There should not be a new warning
         self.assertFirstWarning('error', DeprecationWarning)
         self.assertEqual(1, len(warnings.filters))



More information about the bazaar-commits mailing list