Rev 3458: (jam) Enable Deprecation Warnings when running -Werror and when in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 29 16:57:32 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3458
revision-id:pqm at pqm.ubuntu.com-20080529155716-0w3kic8lioa63231
parent: pqm at pqm.ubuntu.com-20080529152850-mdjpxxj9futs06vu
parent: john at arbash-meinel.com-20080529151445-dyoot5clarhldcht
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-05-29 16:57:16 +0100
message:
(jam) Enable Deprecation Warnings when running -Werror and when
running selftest
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/test_symbol_versioning.py test_symbol_versioning.py-20060105104851-51d7722c2018d42b
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
------------------------------------------------------------
revno: 3427.5.9
revision-id:john at arbash-meinel.com-20080529151445-dyoot5clarhldcht
parent: john at arbash-meinel.com-20080529140425-z0ycjav1ia7nl454
parent: pqm at pqm.ubuntu.com-20080529101301-6s09lakkylik07vp
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Thu 2008-05-29 10:14:45 -0500
message:
merge bzr.dev, move update to new location in HACKING
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/developers/releasing.txt releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
doc/en/user-guide/partner_intro.txt partner_workflow.txt-20071122141511-0knao2lklsdsvb1q-4
doc/en/user-guide/releasing_a_project.txt releasing_a_project.-20071121073725-0corxykv5irjal00-5
doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
doc/en/user-guide/undoing_mistakes.txt undoing_mistakes.txt-20071121092300-8fyacngt1w98e5mp-1
------------------------------------------------------------
revno: 3427.5.8
revision-id:john at arbash-meinel.com-20080529140425-z0ycjav1ia7nl454
parent: john at arbash-meinel.com-20080528232033-cx3l3yg845udklps
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Thu 2008-05-29 09:04:25 -0500
message:
Add comments in NEWS and HACKING about Deprecation Warnings
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
------------------------------------------------------------
revno: 3427.5.7
revision-id:john at arbash-meinel.com-20080528232033-cx3l3yg845udklps
parent: john at arbash-meinel.com-20080528231330-k9ger42pvc1eiw1l
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Wed 2008-05-28 18:20:33 -0500
message:
Bring back always in the form of 'override'.
Change the functions so that they are compatible with the released
definition, and just allow callers to supply override=False
if they want the new behavior.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/test_symbol_versioning.py test_symbol_versioning.py-20060105104851-51d7722c2018d42b
------------------------------------------------------------
revno: 3427.5.6
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
------------------------------------------------------------
revno: 3427.5.5
revision-id:john at arbash-meinel.com-20080528230834-m1qw9peoydd3koty
parent: john at arbash-meinel.com-20080528215346-l8plys9h9ps624pn
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Wed 2008-05-28 18:08:34 -0500
message:
Disable suppression if there is already a filter present for Warnings
modified:
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/test_symbol_versioning.py test_symbol_versioning.py-20060105104851-51d7722c2018d42b
------------------------------------------------------------
revno: 3427.5.4
revision-id:john at arbash-meinel.com-20080528215346-l8plys9h9ps624pn
parent: john at arbash-meinel.com-20080528214415-avxmnvf04nc0df5a
parent: pqm at pqm.ubuntu.com-20080527013230-8qjaju10duxpy3e2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Wed 2008-05-28 16:53:46 -0500
message:
merge bzr.dev
added:
bzrlib/smart/message.py message.py-20080222013625-ncqmh3nrxjkxab87-1
bzrlib/tests/file_utils.py file_utils.py-20080506145406-a1h3ydg2lsh2iriy-1
bzrlib/tests/repository_implementations/test_get_parent_map.py test_get_parent_map.-20080421172708-x1z6ot341osr0jq1-1
doc/es/ es-20080504181154-x2fm3oprvjohiz7n-1
doc/es/guia-desarrollador/ guiadesarrollador-20080504181514-qlh50dq1mj769bic-1
doc/es/guia-usuario/ guiausuario-20080504181514-qlh50dq1mj769bic-2
doc/es/guia-usuario/index.txt index.txt-20080512005856-hgdxkh9xo58n7zdp-2
doc/es/guia-usuario/resolving_conflicts.txt conflicts.txt-20080504181626-aqnzjwfhpju5ypfe-1
doc/es/guia-usuario/version_info.txt version_info.txt-20080504181730-u24nugzokrcrk1bf-1
doc/es/mini-tutorial/ minitutorial-20080504181514-qlh50dq1mj769bic-3
doc/es/mini-tutorial/index.txt index.txt-20080504182136-wmoc35u2t6kom8ca-1
doc/es/notas-version/ notasversion-20080504181514-qlh50dq1mj769bic-4
doc/es/referencia/ referencia-20080504181514-qlh50dq1mj769bic-5
doc/es/referencia-rapida/ referenciarapida-20080504181514-qlh50dq1mj769bic-6
doc/es/referencia-rapida/Makefile makefile-20080506002609-y60mr4avuqwzlf4s-1
doc/es/referencia-rapida/referencia-rapida.svg referenciarapida.svg-20080506002609-y60mr4avuqwzlf4s-2
doc/index.es.txt index.es.txt-20080506002113-aunzdhptcoc0h6hm-1
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/lockable_files.py control_files.py-20051111201905-bb88546e799d669f
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/missing.py missing.py-20050812153334-097f7097e2a8bcd1
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/plugin.py plugin.py-20050622060424-829b654519533d69
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/smart/client.py client.py-20061116014825-2k6ada6xgulslami-1
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/smart/protocol.py protocol.py-20061108035435-ot0lstk2590yqhzr-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
bzrlib/tests/blackbox/test_missing.py test_missing.py-20051211212735-a2cf4c1840bb84c4
bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
bzrlib/tests/branch_implementations/test_permissions.py test_permissions.py-20060210110243-245c01403bf0fde6
bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
bzrlib/tests/repository_implementations/test_has_same_location.py test_has_same_locati-20070807074648-2i2ah82fbe83iys7-1
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_graph.py test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_http_response.py test_http_response.py-20060628233143-950b2a482a32505d
bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
bzrlib/tests/test_missing.py test_missing.py-20051212000028-694fa4f658a81f48
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_osutils_encodings.py test_osutils_encodin-20061226013130-kkp732tpt3lm91vv-1
bzrlib/tests/test_permissions.py test_permissions.py-20051215004520-ccf475789c80e80c
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
bzrlib/tests/workingtree_implementations/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/transport/fakenfs.py fakenfs.py-20060402223312-0e29c7275aa384dd
bzrlib/transport/ftp.py ftp.py-20051116161804-58dc9506548c2a53
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
bzrlib/transport/http/wsgi.py wsgi.py-20061005091552-rz8pva0olkxv0sd8-2
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
doc/developers/network-protocol.txt networkprotocol.txt-20070903044232-woustorrjbmg5zol-1
doc/developers/tortoise-strategy.txt tortoisestrategy.txt-20080403024510-2ahdqrvnwqrb5p5t-1
doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
doc/en/user-guide/bzrtools_plugin.txt bzrtools_plugin.txt-20080509065016-cjc90f46407vi9a0-1
doc/en/user-guide/distributed_intro.txt distributed_intro.tx-20071123154453-dk2mjhrg1vpjm5w2-2
doc/en/user-guide/index.txt index.txt-20060622101119-tgwtdci8z769bjb9-2
doc/en/user-guide/part2_intro.txt best_practice_intro.-20071123154453-dk2mjhrg1vpjm5w2-1
doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
doc/en/user-guide/web_browsing.txt web_browsing.txt-20080509065016-cjc90f46407vi9a0-3
doc/index.txt index.txt-20070813101924-07gd9i9d2jt124bf-1
------------------------------------------------------------
revno: 3427.5.3
revision-id:john at arbash-meinel.com-20080528214415-avxmnvf04nc0df5a
parent: john at arbash-meinel.com-20080516165227-3r5vc1f15r5hno45
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Wed 2008-05-28 16:44:15 -0500
message:
Update the activate_deprecation_warnings so it can be skipped if there is already an error set.
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
------------------------------------------------------------
revno: 3427.5.2
revision-id:john at arbash-meinel.com-20080516165227-3r5vc1f15r5hno45
parent: john at arbash-meinel.com-20080515155945-nzk1pjufnkbti4bb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Fri 2008-05-16 11:52:27 -0500
message:
Revert the changes to cmd_selftest, so that -Werror still works.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
------------------------------------------------------------
revno: 3427.5.1
revision-id:john at arbash-meinel.com-20080515155945-nzk1pjufnkbti4bb
parent: pqm at pqm.ubuntu.com-20080512115743-6uz3lnmrrbhmoiqe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dep_warnings
timestamp: Thu 2008-05-15 10:59:45 -0500
message:
Have the bzrlib.commands.main() function suppress deprecation warnings when running a final release.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
=== modified file 'NEWS'
--- a/NEWS 2008-05-29 02:38:43 +0000
+++ b/NEWS 2008-05-29 15:14:45 +0000
@@ -14,6 +14,10 @@
CHANGES:
+ * Deprecation warnings will not be suppressed when running ``bzr selftest``
+ so that developers can see if their code is using deprecated functions.
+ (John Arbash Meinel)
+
FEATURES:
* Adding ``-Derror`` will now display a traceback when a plugin fails to
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-05-22 05:48:22 +0000
+++ b/bzrlib/builtins.py 2008-05-28 23:20:33 +0000
@@ -2656,6 +2656,9 @@
import bzrlib.benchmarks as benchmarks
from bzrlib.benchmarks import tree_creator
+ # Make deprecation warnings visible, unless -Werror is set
+ symbol_versioning.activate_deprecation_warnings(override=False)
+
if cache_dir is not None:
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
if not list_only:
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2008-05-16 16:54:44 +0000
+++ b/bzrlib/commands.py 2008-05-28 23:20:33 +0000
@@ -828,7 +828,7 @@
# Is this a final release version? If so, we should suppress warnings
if bzrlib.version_info[3] == 'final':
from bzrlib import symbol_versioning
- symbol_versioning.suppress_deprecation_warnings()
+ symbol_versioning.suppress_deprecation_warnings(override=False)
try:
argv = [a.decode(bzrlib.user_encoding) for a in argv[1:]]
except UnicodeDecodeError:
=== modified file 'bzrlib/symbol_versioning.py'
--- a/bzrlib/symbol_versioning.py 2008-05-19 20:54:37 +0000
+++ b/bzrlib/symbol_versioning.py 2008-05-28 23:20:33 +0000
@@ -333,18 +333,40 @@
return _DeprecatedList(initial_value)
-def suppress_deprecation_warnings():
+def _check_for_filter(error_only):
+ """Check if there is already a filter for deprecation warnings.
+
+ :param error_only: Only match an 'error' filter
+ :return: True if a filter is found, False otherwise
+ """
+ import warnings
+ for filter in warnings.filters:
+ if issubclass(DeprecationWarning, filter[2]):
+ # This filter will effect DeprecationWarning
+ if not error_only or filter[0] == 'error':
+ return True
+ return False
+
+
+def suppress_deprecation_warnings(override=True):
"""Call this function to suppress all deprecation warnings.
When this is a final release version, we don't want to annoy users with
lots of deprecation warnings. We only want the deprecation warnings when
running a dev or release candidate.
+
+ :param override: If True, always set the ignore, if False, only set the
+ ignore if there isn't already a filter.
"""
import warnings
+ if not override and _check_for_filter(error_only=False):
+ # If there is already a filter effecting suppress_deprecation_warnings,
+ # then skip it.
+ return
warnings.filterwarnings('ignore', category=DeprecationWarning)
-def activate_deprecation_warnings():
+def activate_deprecation_warnings(override=True):
"""Call this function to activate deprecation warnings.
When running in a 'final' release we suppress deprecation warnings.
@@ -354,6 +376,14 @@
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 override: If False, only add a filter if there isn't an error filter
+ already. (This slightly differs from suppress_deprecation_warnings, in
+ because it always overrides everything but -Werror).
"""
import warnings
+ if not override and _check_for_filter(error_only=True):
+ # DeprecationWarnings are already turned into errors, don't downgrade
+ # them to 'default'.
+ return
warnings.filterwarnings('default', category=DeprecationWarning)
=== modified file 'bzrlib/tests/test_symbol_versioning.py'
--- a/bzrlib/tests/test_symbol_versioning.py 2007-09-18 04:21:20 +0000
+++ b/bzrlib/tests/test_symbol_versioning.py 2008-05-28 23:20:33 +0000
@@ -18,7 +18,9 @@
"""Symbol versioning tests."""
-import bzrlib.symbol_versioning as symbol_versioning
+import warnings
+
+from bzrlib import symbol_versioning
from bzrlib.tests import TestCase
@@ -207,3 +209,75 @@
symbol_versioning.deprecation_string(
symbol_versioning.deprecated_function,
symbol_versioning.zero_eleven))
+
+
+class TestSuppressAndActivate(TestCase):
+
+ def setUp(self):
+ existing_filters = list(warnings.filters)
+ def restore():
+ warnings.filters[:] = existing_filters
+ self.addCleanup(restore)
+ # Clean out the filters so we have a clean slate.
+ warnings.resetwarnings()
+
+ def assertFirstWarning(self, action, category):
+ """Test the first warning in the filters is correct"""
+ first = warnings.filters[0]
+ self.assertEqual((action, category), (first[0], first[2]))
+
+ def test_suppress_deprecation_warnings(self):
+ """suppress_deprecation_warnings sets DeprecationWarning to ignored."""
+ symbol_versioning.suppress_deprecation_warnings()
+ self.assertFirstWarning('ignore', DeprecationWarning)
+
+ def test_suppress_deprecation_with_warning_filter(self):
+ """don't suppress if we already have a filter"""
+ warnings.filterwarnings('error', category=Warning)
+ self.assertFirstWarning('error', Warning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.suppress_deprecation_warnings(override=False)
+ self.assertFirstWarning('error', Warning)
+ self.assertEqual(1, len(warnings.filters))
+
+ def test_suppress_deprecation_with_filter(self):
+ """don't suppress if we already have a filter"""
+ warnings.filterwarnings('error', category=DeprecationWarning)
+ self.assertFirstWarning('error', DeprecationWarning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.suppress_deprecation_warnings(override=False)
+ self.assertFirstWarning('error', DeprecationWarning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.suppress_deprecation_warnings(override=True)
+ self.assertFirstWarning('ignore', DeprecationWarning)
+ self.assertEqual(2, len(warnings.filters))
+
+ def test_activate_deprecation_no_error(self):
+ # First nuke the filters, so we know it is clean
+ symbol_versioning.activate_deprecation_warnings()
+ self.assertFirstWarning('default', DeprecationWarning)
+
+ def test_activate_deprecation_with_error(self):
+ # First nuke the filters, so we know it is clean
+ # Add a warning == error rule
+ warnings.filterwarnings('error', category=Warning)
+ self.assertFirstWarning('error', Warning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.activate_deprecation_warnings(override=False)
+ # There should not be a new warning
+ self.assertFirstWarning('error', Warning)
+ self.assertEqual(1, len(warnings.filters))
+
+ def test_activate_deprecation_with_DW_error(self):
+ # First nuke the filters, so we know it is clean
+ # Add a warning == error rule
+ warnings.filterwarnings('error', category=DeprecationWarning)
+ self.assertFirstWarning('error', DeprecationWarning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.activate_deprecation_warnings(override=False)
+ # There should not be a new warning
+ self.assertFirstWarning('error', DeprecationWarning)
+ self.assertEqual(1, len(warnings.filters))
+ symbol_versioning.activate_deprecation_warnings(override=True)
+ self.assertFirstWarning('default', DeprecationWarning)
+ self.assertEqual(2, len(warnings.filters))
=== modified file 'doc/developers/HACKING.txt'
--- a/doc/developers/HACKING.txt 2008-05-29 02:38:43 +0000
+++ b/doc/developers/HACKING.txt 2008-05-29 15:14:45 +0000
@@ -1003,6 +1003,12 @@
the expected deprecation message, and also returns the real result from
the method, so that tests can keep running.
+Deprecation warnings will be suppressed for final releases, but not for
+development versions or release candidates, or when running ``bzr
+selftest``. This gives developers information about whether their code is
+using deprecated functions, but avoids confusing users about things they
+can't fix.
+
Getting Input
=============
More information about the bazaar-commits
mailing list