~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_features.py

  • Committer: Patch Queue Manager
  • Date: 2013-05-20 17:46:29 UTC
  • mfrom: (6573.1.1 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20130520174629-dp7zujtuclvomuzd
(jameinel) Fix CVE 2013-2009. Avoid allowing multiple wildcards in a single
 SSL cert hostname segment. (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Tests for test feature dependencies.
18
 
"""
 
17
"""Tests for test feature dependencies."""
 
18
 
 
19
import sys
19
20
 
20
21
from bzrlib import (
21
22
    symbol_versioning,
88
89
            simple_thunk_feature.available)
89
90
        self.assertEqual(features.UnicodeFilenameFeature.available(), res)
90
91
 
 
92
    def test_reports_correct_location(self):
 
93
        a_feature = features._CompatabilityThunkFeature(
 
94
            symbol_versioning.deprecated_in((2, 1, 0)),
 
95
            'bzrlib.tests.test_features',
 
96
            'a_feature',
 
97
            'UnicodeFilenameFeature',
 
98
            replacement_module='bzrlib.tests.features')
 
99
        def test_caller(message, category=None, stacklevel=1):
 
100
            # Find ourselves back from the right frame
 
101
            caller = sys._getframe(stacklevel)
 
102
            reported_file = caller.f_globals['__file__']
 
103
            reported_lineno = caller.f_lineno
 
104
            self.assertEquals(__file__, reported_file)
 
105
            # The call we're tracking occurred the line after we grabbed the
 
106
            # lineno.
 
107
            self.assertEquals(self.lineno + 1, reported_lineno)
 
108
        self.overrideAttr(symbol_versioning, 'warn', test_caller)
 
109
        # Grab the current lineno
 
110
        self.lineno = sys._getframe().f_lineno
 
111
        self.requireFeature(a_feature)
 
112
 
91
113
 
92
114
class TestModuleAvailableFeature(tests.TestCase):
93
115