~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_symbol_versioning.py

[merge] jam-integration 1527, including branch-formats, help text, misc bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
class TestDeprecationWarnings(TestCase):
31
31
 
32
 
    def capture_warning(self, message, category):
33
 
        self._warnings.append((message, category))
 
32
    def capture_warning(self, message, category, stacklevel=None):
 
33
        self._warnings.append((message, category, stacklevel))
34
34
 
35
35
    def setUp(self):
36
36
        super(TestDeprecationWarnings, self).setUp()
48
48
        expected_warning = (
49
49
            "bzrlib.tests.test_symbol_versioning."
50
50
            "TestDeprecationWarnings.deprecated_method "
51
 
            "was deprecated in version 0.7.", DeprecationWarning)
 
51
            "was deprecated in version 0.7.", DeprecationWarning, 2)
52
52
        expected_docstring = ('Deprecated method docstring.\n'
53
53
                              '        \n'
54
54
                              '        This might explain stuff.\n'
63
63
    def test_deprecated_function(self):
64
64
        expected_warning = (
65
65
            "bzrlib.tests.test_symbol_versioning.deprecated_function "
66
 
            "was deprecated in version 0.7.", DeprecationWarning)
 
66
            "was deprecated in version 0.7.", DeprecationWarning, 2)
67
67
        expected_docstring = ('Deprecated function docstring.\n'
68
68
                              '\n'
69
69
                              'This function was deprecated in version 0.7.\n'
89
89
            self.assertEqualDiff(expected_module, deprecated_callable.__module__)
90
90
        finally:
91
91
            symbol_versioning.set_warning_method(old_warning_method)
 
92
    
 
93
    def test_deprecated_passed(self):
 
94
        self.assertEqual(True, symbol_versioning.deprecated_passed(None))
 
95
        self.assertEqual(True, symbol_versioning.deprecated_passed(True))
 
96
        self.assertEqual(True, symbol_versioning.deprecated_passed(False))
 
97
        self.assertEqual(False,
 
98
                         symbol_versioning.deprecated_passed(
 
99
                            symbol_versioning.DEPRECATED_PARAMETER))