~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_features.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
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
 
 
19
 
import sys
 
17
"""Tests for test feature dependencies.
 
18
"""
20
19
 
21
20
from bzrlib import (
22
21
    symbol_versioning,
89
88
            simple_thunk_feature.available)
90
89
        self.assertEqual(features.UnicodeFilenameFeature.available(), res)
91
90
 
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.assertEqual(__file__, reported_file)
105
 
            # The call we're tracking occurred the line after we grabbed the
106
 
            # lineno.
107
 
            self.assertEqual(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
 
 
113
91
 
114
92
class TestModuleAvailableFeature(tests.TestCase):
115
93