summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-08-11 14:14:37 +0200
committerZac Medico <zmedico@gentoo.org>2010-08-11 11:10:28 -0700
commitf61743bfc8d48c12585fd5499646369270b0d391 (patch)
tree69fd58d4f75f530c9cf57822a31193d3df0256a8 /pym
parentaf52e04dd1709b5b4d48fdee90b2d04f67617234 (diff)
downloadportage-f61743bfc8d48c12585fd5499646369270b0d391.tar.gz
portage-f61743bfc8d48c12585fd5499646369270b0d391.tar.bz2
portage-f61743bfc8d48c12585fd5499646369270b0d391.zip
Tests: add resolver/test_required_use
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/tests/resolver/test_required_use.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/pym/portage/tests/resolver/test_required_use.py b/pym/portage/tests/resolver/test_required_use.py
new file mode 100644
index 000000000..1c3744822
--- /dev/null
+++ b/pym/portage/tests/resolver/test_required_use.py
@@ -0,0 +1,44 @@
+# Copyright 2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase
+
+class RequiredUSETestCase(TestCase):
+
+ def testRequiredUSE(self):
+ """
+ Only simple REQUIRED_USE values here. The parser is tested under in dep/testCheckRequiredUse
+ """
+
+ ebuilds = {
+ "dev-libs/A-1": {"EAPI": 4, "IUSE": "foo bar", "REQUIRED_USE": "|| ( foo bar )"},
+ "dev-libs/A-2": {"EAPI": 4, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )"},
+ "dev-libs/A-3": {"EAPI": 4, "IUSE": "+foo bar", "REQUIRED_USE": "|| ( foo bar )"},
+ "dev-libs/A-4": {"EAPI": 4, "IUSE": "+foo +bar", "REQUIRED_USE": "|| ( foo bar )"},
+
+ "dev-libs/B-1": {"EAPI": 4, "IUSE": "foo bar", "REQUIRED_USE": "^^ ( foo bar )"},
+ "dev-libs/B-2": {"EAPI": 4, "IUSE": "foo +bar", "REQUIRED_USE": "^^ ( foo bar )"},
+ "dev-libs/B-3": {"EAPI": 4, "IUSE": "+foo bar", "REQUIRED_USE": "^^ ( foo bar )"},
+ "dev-libs/B-4": {"EAPI": 4, "IUSE": "+foo +bar", "REQUIRED_USE": "^^ ( foo bar )"},
+ }
+
+ test_cases = (
+ ResolverPlaygroundTestCase(["=dev-libs/A-1"], success = False),
+ ResolverPlaygroundTestCase(["=dev-libs/A-2"], success = True, mergelist=["dev-libs/A-2"]),
+ ResolverPlaygroundTestCase(["=dev-libs/A-3"], success = True, mergelist=["dev-libs/A-3"]),
+ ResolverPlaygroundTestCase(["=dev-libs/A-4"], success = True, mergelist=["dev-libs/A-4"]),
+
+ ResolverPlaygroundTestCase(["=dev-libs/B-1"], success = False),
+ ResolverPlaygroundTestCase(["=dev-libs/B-2"], success = True, mergelist=["dev-libs/B-2"]),
+ ResolverPlaygroundTestCase(["=dev-libs/B-3"], success = True, mergelist=["dev-libs/B-3"]),
+ ResolverPlaygroundTestCase(["=dev-libs/B-4"], success = False),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds)
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+ finally:
+ playground.cleanup()