~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_symbol_versioning.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-10 17:52:08 UTC
  • mfrom: (5021 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5023.
  • Revision ID: john@arbash-meinel.com-20100210175208-bubuwav4uqigu291
Merge bzr.dev 5021 to resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
from bzrlib.symbol_versioning import (
23
23
    deprecated_function,
24
24
    deprecated_in,
 
25
    deprecated_list,
25
26
    deprecated_method,
26
27
    )
27
28
from bzrlib.tests import TestCase
178
179
    def check_deprecated_callable(self, expected_warning, expected_docstring,
179
180
                                  expected_name, expected_module,
180
181
                                  deprecated_callable):
181
 
        if __doc__ is None:
182
 
            # With -OO the docstring should just be the deprecated version
183
 
            expected_docstring = expected_docstring.split('\n')[-2].lstrip()
184
182
        old_warning_method = symbol_versioning.warn
185
183
        try:
186
184
            symbol_versioning.set_warning_method(self.capture_warning)
240
238
        symbol_versioning.suppress_deprecation_warnings()
241
239
        self.assertFirstWarning('ignore', DeprecationWarning)
242
240
 
243
 
    def test_set_restore_filters(self):
244
 
        original_filters = warnings.filters[:]
245
 
        symbol_versioning.suppress_deprecation_warnings()()
246
 
        self.assertEqual(original_filters, warnings.filters)
247
 
 
248
241
    def test_suppress_deprecation_with_warning_filter(self):
249
242
        """don't suppress if we already have a filter"""
250
243
        warnings.filterwarnings('error', category=Warning)