summaryrefslogtreecommitdiffstats
path: root/pym/portage/tests/dep
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-03 15:29:50 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-03 15:29:50 -0800
commitc9ed39f98c62760333c9fe4d4ef5b8caa06a9e16 (patch)
tree62e4cc25b55269ffe9f3d9c77c7054eeeda9b5bd /pym/portage/tests/dep
parent3b4262ff0e1903f1c8dc8a9e3c34bb442deea04b (diff)
downloadportage-c9ed39f98c62760333c9fe4d4ef5b8caa06a9e16.tar.gz
portage-c9ed39f98c62760333c9fe4d4ef5b8caa06a9e16.tar.bz2
portage-c9ed39f98c62760333c9fe4d4ef5b8caa06a9e16.zip
REQUIRED_USE: display unsatisfied part
This will fix bug #353234.
Diffstat (limited to 'pym/portage/tests/dep')
-rw-r--r--pym/portage/tests/dep/testCheckRequiredUse.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py
index 4b67d6250..0f7a299e9 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -103,9 +103,42 @@ class TestCheckRequiredUse(TestCase):
)
for required_use, use, iuse, expected in test_cases:
- self.assertEqual(check_required_use(required_use, use, iuse.__contains__), \
+ self.assertEqual(bool(check_required_use(required_use, use, iuse.__contains__)), \
expected, required_use + ", USE = " + " ".join(use))
for required_use, use, iuse in test_cases_xfail:
self.assertRaisesMsg(required_use + ", USE = " + " ".join(use), \
InvalidDependString, check_required_use, required_use, use, iuse.__contains__)
+
+ def testCheckRequiredUseFilterSatisfied(self):
+ """
+ Test filtering of satisfied parts of REQUIRED_USE,
+ in order to reduce noise for bug #353234.
+ """
+ test_cases = (
+ (
+ "bindist? ( !amr !faac !win32codecs ) cdio? ( !cdparanoia !cddb ) dvdnav? ( dvd )",
+ ("cdio", "cdparanoia"),
+ "cdio? ( !cdparanoia )"
+ ),
+ (
+ "|| ( !amr !faac !win32codecs ) cdio? ( !cdparanoia !cddb ) ^^ ( foo bar )",
+ ["cdio", "cdparanoia", "foo"],
+ "cdio? ( !cdparanoia )"
+ ),
+ (
+ "^^ ( || ( a b ) c )",
+ ("a", "b", "c"),
+ "^^ ( || ( a b ) c )"
+ ),
+ (
+ "^^ ( || ( ( a b ) ) ( c ) )",
+ ("a", "b", "c"),
+ "^^ ( || ( ( a b ) ) ( c ) )"
+ )
+ )
+ for required_use, use, expected in test_cases:
+ result = check_required_use(required_use, use, lambda k: True).tounicode()
+ self.assertEqual(result, expected,
+ "REQUIRED_USE = '%s', USE = '%s', '%s' != '%s'" % \
+ (required_use, " ".join(use), result, expected))