~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_symbol_versioning.py

Bugfix the symbol_versioning deprecation decorators to update the
__module__ attribute of methods and functions. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                              '        ')
58
58
        self.check_deprecated_callable(expected_warning, expected_docstring,
59
59
                                       "deprecated_method",
 
60
                                       "bzrlib.tests.test_symbol_versioning",
60
61
                                       self.deprecated_method)
61
62
 
62
63
    def test_deprecated_function(self):
69
70
                              )
70
71
        self.check_deprecated_callable(expected_warning, expected_docstring,
71
72
                                       "deprecated_function",
 
73
                                       "bzrlib.tests.test_symbol_versioning",
72
74
                                       deprecated_function)
73
75
 
74
76
    def check_deprecated_callable(self, expected_warning, expected_docstring,
75
 
                                  expected_name,
 
77
                                  expected_name, expected_module,
76
78
                                  deprecated_callable):
77
79
        old_warning_method = symbol_versioning.warn
78
80
        try:
84
86
                             self._warnings)
85
87
            self.assertEqualDiff(expected_docstring, deprecated_callable.__doc__)
86
88
            self.assertEqualDiff(expected_name, deprecated_callable.__name__)
 
89
            self.assertEqualDiff(expected_module, deprecated_callable.__module__)
87
90
        finally:
88
91
            symbol_versioning.set_warning_method(old_warning_method)