/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_symbol_versioning.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 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
76
76
        expected_warning = (
77
77
            "bzrlib.tests.test_symbol_versioning."
78
78
            "deprecated_static "
79
 
            "was deprecated in version 0.7.0.", DeprecationWarning, 2)
 
79
            "was deprecated in version 0.7.", DeprecationWarning, 2)
80
80
        expected_docstring = (
81
81
            'Deprecated static.\n'
82
82
            '\n'
83
 
            'This function was deprecated in version 0.7.0.\n'
 
83
            'This function was deprecated in version 0.7.\n'
84
84
            )
85
85
        self.check_deprecated_callable(
86
86
            expected_warning, expected_docstring,
92
92
        expected_warning = (
93
93
            "bzrlib.tests.test_symbol_versioning."
94
94
            "TestDeprecationWarnings.deprecated_method "
95
 
            "was deprecated in version 0.7.0.", DeprecationWarning, 2)
96
 
        expected_docstring = (
97
 
            'Deprecated method docstring.\n'
98
 
            '\n'
99
 
            '        This might explain stuff.\n'
100
 
            '        \n'
101
 
            '        This method was deprecated in version 0.7.0.\n'
102
 
            '        ')
 
95
            "was deprecated in version 0.7.", DeprecationWarning, 2)
 
96
        expected_docstring = ('Deprecated method docstring.\n'
 
97
                              '\n'
 
98
                              '        This might explain stuff.\n'
 
99
                              '        \n'
 
100
                              '        This method was deprecated in version 0.7.\n'
 
101
                              '        ')
103
102
        self.check_deprecated_callable(expected_warning, expected_docstring,
104
103
                                       "deprecated_method",
105
104
                                       "bzrlib.tests.test_symbol_versioning",
108
107
    def test_deprecated_function(self):
109
108
        expected_warning = (
110
109
            "bzrlib.tests.test_symbol_versioning.sample_deprecated_function "
111
 
            "was deprecated in version 0.7.0.", DeprecationWarning, 2)
 
110
            "was deprecated in version 0.7.", DeprecationWarning, 2)
112
111
        expected_docstring = ('Deprecated function docstring.\n'
113
112
                              '\n'
114
 
                              'This function was deprecated in version 0.7.0.\n'
 
113
                              'This function was deprecated in version 0.7.\n'
115
114
                              )
116
115
        self.check_deprecated_callable(expected_warning, expected_docstring,
117
116
                                       "sample_deprecated_function",
120
119
 
121
120
    def test_deprecated_list(self):
122
121
        expected_warning = (
123
 
            "Modifying a_deprecated_list was deprecated in version 0.9.0."
 
122
            "Modifying a_deprecated_list was deprecated in version 0.9."
124
123
            " Don't use me", DeprecationWarning, 3)
125
124
        old_warning_method = symbol_versioning.warn
126
125
        try:
158
157
 
159
158
    def test_deprecated_dict(self):
160
159
        expected_warning = (
161
 
            "access to a_deprecated_dict was deprecated in version 0.14.0."
 
160
            "access to a_deprecated_dict was deprecated in version 0.14."
162
161
            " Pull the other one!", DeprecationWarning, 2)
163
162
        old_warning_method = symbol_versioning.warn
164
163
        try:
179
178
    def check_deprecated_callable(self, expected_warning, expected_docstring,
180
179
                                  expected_name, expected_module,
181
180
                                  deprecated_callable):
182
 
        if __doc__ is None:
183
 
            # With -OO the docstring should just be the deprecated version
184
 
            expected_docstring = expected_docstring.split('\n')[-2].lstrip()
185
181
        old_warning_method = symbol_versioning.warn
186
182
        try:
187
183
            symbol_versioning.set_warning_method(self.capture_warning)
209
205
        """We can get a deprecation string for a method or function."""
210
206
        self.assertEqual('bzrlib.tests.test_symbol_versioning.'
211
207
            'TestDeprecationWarnings.test_deprecation_string was deprecated in '
212
 
            'version 0.11.0.',
 
208
            'version 0.11.',
213
209
            symbol_versioning.deprecation_string(
214
210
            self.test_deprecation_string,
215
211
            deprecated_in((0, 11, 0))))
216
212
        self.assertEqual('bzrlib.symbol_versioning.deprecated_function was '
217
 
            'deprecated in version 0.11.0.',
 
213
            'deprecated in version 0.11.',
218
214
            symbol_versioning.deprecation_string(
219
215
                symbol_versioning.deprecated_function,
220
216
                deprecated_in((0, 11, 0))))