From: Zac Medico Date: Fri, 4 Jan 2013 04:35:40 +0000 (-0800) Subject: test_paren_reduce: disable deprecation warning X-Git-Tag: v2.2.0_alpha150~44 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fe1194b25031f40e51d1a82352bb7d79bcafe912;p=portage.git test_paren_reduce: disable deprecation warning --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 916d5ea66..67383e882 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -255,7 +255,7 @@ def strip_empty(myarr): ('portage.dep.strip_empty',), DeprecationWarning, stacklevel=2) return [x for x in myarr if x] -def paren_reduce(mystr): +def paren_reduce(mystr, _deprecation_warn=True): """ Take a string and convert all paren enclosed entities into sublists and split the list elements by spaces. All redundant brackets are removed. @@ -269,7 +269,7 @@ def paren_reduce(mystr): @rtype: Array @return: The reduced string in an array """ - if portage._internal_caller: + if portage._internal_caller and _deprecation_warn: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2) mysplit = mystr.split() diff --git a/pym/portage/tests/dep/test_paren_reduce.py b/pym/portage/tests/dep/test_paren_reduce.py index 9a147a02e..1dfa64853 100644 --- a/pym/portage/tests/dep/test_paren_reduce.py +++ b/pym/portage/tests/dep/test_paren_reduce.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -57,10 +57,13 @@ class TestParenReduce(TestCase): ) for dep_str, expected_result in test_cases: - self.assertEqual(paren_reduce(dep_str), expected_result, + self.assertEqual(paren_reduce(dep_str, _deprecation_warn=False), + expected_result, "input: '%s' result: %s != %s" % (dep_str, - paren_reduce(dep_str), expected_result)) + paren_reduce(dep_str, _deprecation_warn=False), + expected_result)) for dep_str in test_cases_xfail: self.assertRaisesMsg(dep_str, - InvalidDependString, paren_reduce, dep_str) + InvalidDependString, paren_reduce, dep_str, + _deprecation_warn=False)