test_paren_reduce: disable deprecation warning
authorZac Medico <zmedico@gentoo.org>
Fri, 4 Jan 2013 04:35:40 +0000 (20:35 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 4 Jan 2013 04:35:40 +0000 (20:35 -0800)
pym/portage/dep/__init__.py
pym/portage/tests/dep/test_paren_reduce.py

index 916d5ea6697591acaae75bce652d716124dee328..67383e882aa75405e07e4df7db6f2e57cb9380e3 100644 (file)
@@ -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()
index 9a147a02ef00606d3bb82db2b84728820137c74b..1dfa648536bc2bce54b476bb4f2acd23decaf2d1 100644 (file)
@@ -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)