def test_reports_correct_location(self): a_feature = features._CompatabilityThunkFeature( symbol_versioning.deprecated_in((2, 1, 0)), 'bzrlib.tests.test_features', 'a_feature', 'UnicodeFilenameFeature', replacement_module='bzrlib.tests.features') def test_caller(message, category=None, stacklevel=1): # Find ourselves back from the right frame caller = sys._getframe(stacklevel) reported_file = caller.f_globals['__file__'] reported_lineno = caller.f_lineno self.assertEquals(__file__, reported_file) # The call we're tracking occurred the line after we grabbed the # lineno. self.assertEquals(self.lineno + 1, reported_lineno) self.overrideAttr(symbol_versioning, 'warn', test_caller) # Grab the current lineno self.lineno = sys._getframe().f_lineno self.requireFeature(a_feature)
def test_reports_correct_location(self): a_feature = features._CompatabilityThunkFeature( symbol_versioning.deprecated_in((2, 1, 0)), 'bzrlib.tests.test_features', 'a_feature', 'UnicodeFilenameFeature', replacement_module='bzrlib.tests.features') def test_caller(message, category=None, stacklevel=1): # Find ourselves back from the right frame caller = sys._getframe(stacklevel) reported_file = caller.f_globals['__file__'] reported_lineno = caller.f_lineno self.assertEqual(__file__, reported_file) # The call we're tracking occurred the line after we grabbed the # lineno. self.assertEqual(self.lineno + 1, reported_lineno) self.overrideAttr(symbol_versioning, 'warn', test_caller) # Grab the current lineno self.lineno = sys._getframe().f_lineno self.requireFeature(a_feature)
feature = NamedFeature() self.assertEqual('NamedFeature', str(feature)) class TestUnavailableFeature(tests.TestCase): def test_access_feature(self): feature = features.Feature() exception = tests.UnavailableFeature(feature) self.assertIs(feature, exception.args[0]) # Although this was deprecated a long time ago, please keep it here because # it's really just a test fixture for test-feature deprecation. simple_thunk_feature = features._CompatabilityThunkFeature( symbol_versioning.deprecated_in((2, 1, 0)), 'bzrlib.tests.test_features', 'simple_thunk_feature', 'UnicodeFilenameFeature', replacement_module='bzrlib.tests.features') class Test_CompatibilityFeature(tests.TestCase): def test_does_thunk(self): res = self.callDeprecated([ 'bzrlib.tests.test_features.simple_thunk_feature ' 'was deprecated in version 2.1.0. ' 'Use bzrlib.tests.features.UnicodeFilenameFeature instead.' ], simple_thunk_feature.available) self.assertEqual(features.UnicodeFilenameFeature.available(), res) def test_reports_correct_location(self): a_feature = features._CompatabilityThunkFeature(
self.assertEqual('NamedFeature', str(feature)) class TestUnavailableFeature(tests.TestCase): def test_access_feature(self): feature = features.Feature() exception = tests.UnavailableFeature(feature) self.assertIs(feature, exception.args[0]) # Although this was deprecated a long time ago, please keep it here because # it's really just a test fixture for test-feature deprecation. simple_thunk_feature = features._CompatabilityThunkFeature( symbol_versioning.deprecated_in((2, 1, 0)), 'bzrlib.tests.test_features', 'simple_thunk_feature', 'UnicodeFilenameFeature', replacement_module='bzrlib.tests.features') class Test_CompatibilityFeature(tests.TestCase): def test_does_thunk(self): res = self.callDeprecated( ['bzrlib.tests.test_features.simple_thunk_feature ' 'was deprecated in version 2.1.0. ' 'Use bzrlib.tests.features.UnicodeFilenameFeature instead.'], simple_thunk_feature.available) self.assertEqual(features.UnicodeFilenameFeature.available(), res) def test_reports_correct_location(self):