summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-08-05 16:29:31 +0200
committerZac Medico <zmedico@gentoo.org>2010-08-05 13:37:33 -0700
commitcafa8cf69be8eaaccf51c7befab814f6fd8eb89a (patch)
treeee24a639e5b6f0cf7b5a8194412adc3f38dd206b
parentTests: Add resolver/test_simple and the resolver test infrastructure (diff)
downloadportage-multirepo-cafa8cf69be8eaaccf51c7befab814f6fd8eb89a.tar.gz
portage-multirepo-cafa8cf69be8eaaccf51c7befab814f6fd8eb89a.tar.bz2
portage-multirepo-cafa8cf69be8eaaccf51c7befab814f6fd8eb89a.zip
Tests: Add resolver/test_eapi (2 tests disabled)
The resolver accepts EAPI-0 ebuilds with IUSE defaults and slot dependencies.
-rw-r--r--pym/portage/tests/resolver/ResolverPlayground.py4
-rw-r--r--pym/portage/tests/resolver/test_eapi.py98
-rw-r--r--pym/portage/tests/resolver/test_simple.py4
3 files changed, 103 insertions, 3 deletions
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 56cdb5f4..643a3b61 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -178,9 +178,13 @@ class ResolverPlayground(object):
myopts["--quiet"] = True
myopts["--root"] = self.root
myopts["--config-root"] = self.root
+ myopts["--root-deps"] = "rdeps"
+
+ portage.util.noiselimit = -2
myparams = create_depgraph_params(myopts, myaction)
success, mydepgraph, favorites = backtrack_depgraph(
self.settings, self.trees, myopts, myparams, myaction, myfiles, None)
+ portage.util.noiselimit = 0
if success:
mergelist = [x.cpv for x in mydepgraph._dynamic_config._serialized_tasks_cache]
diff --git a/pym/portage/tests/resolver/test_eapi.py b/pym/portage/tests/resolver/test_eapi.py
new file mode 100644
index 00000000..f2eff44d
--- /dev/null
+++ b/pym/portage/tests/resolver/test_eapi.py
@@ -0,0 +1,98 @@
+# 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
+
+class SimpleResolverTestCase(TestCase):
+
+ def testEAPI(self):
+ ebuilds = {
+ #EAPI-1: IUSE-defaults
+ "dev-libs/A-1.0": { "EAPI": 0, "IUSE": "+foo" },
+ "dev-libs/A-1.1": { "EAPI": 1, "IUSE": "+foo" },
+ "dev-libs/A-1.2": { "EAPI": 2, "IUSE": "+foo" },
+ "dev-libs/A-1.3": { "EAPI": 3, "IUSE": "+foo" },
+ #~ "dev-libs/A-1.4": { "EAPI": 4, "IUSE": "+foo" },
+
+ #EAPI-1: slot deps
+ "dev-libs/A-2.0": { "EAPI": 0, "DEPEND": "dev-libs/B:0" },
+ "dev-libs/A-2.1": { "EAPI": 1, "DEPEND": "dev-libs/B:0" },
+ "dev-libs/A-2.2": { "EAPI": 2, "DEPEND": "dev-libs/B:0" },
+ "dev-libs/A-2.3": { "EAPI": 3, "DEPEND": "dev-libs/B:0" },
+ #~ "dev-libs/A-2.4": { "EAPI": 4, "DEPEND": "dev-libs/B:0" },
+
+ #EAPI-2: use deps
+ "dev-libs/A-3.0": { "EAPI": 0, "DEPEND": "dev-libs/B[foo]" },
+ "dev-libs/A-3.1": { "EAPI": 1, "DEPEND": "dev-libs/B[foo]" },
+ "dev-libs/A-3.2": { "EAPI": 2, "DEPEND": "dev-libs/B[foo]" },
+ "dev-libs/A-3.3": { "EAPI": 3, "DEPEND": "dev-libs/B[foo]" },
+ #~ "dev-libs/A-3.4": { "EAPI": 4, "DEPEND": "dev-libs/B[foo]" },
+
+ #EAPI-2: strong blocks
+ "dev-libs/A-4.0": { "EAPI": 0, "DEPEND": "!!dev-libs/B" },
+ "dev-libs/A-4.1": { "EAPI": 1, "DEPEND": "!!dev-libs/B" },
+ "dev-libs/A-4.2": { "EAPI": 2, "DEPEND": "!!dev-libs/B" },
+ "dev-libs/A-4.3": { "EAPI": 3, "DEPEND": "!!dev-libs/B" },
+ #~ "dev-libs/A-4.4": { "EAPI": 4, "DEPEND": "!!dev-libs/B" },
+
+ #EAPI-4: slot operator deps
+ #~ "dev-libs/A-5.0": { "EAPI": 0, "DEPEND": "dev-libs/B:*" },
+ #~ "dev-libs/A-5.1": { "EAPI": 1, "DEPEND": "dev-libs/B:*" },
+ #~ "dev-libs/A-5.2": { "EAPI": 2, "DEPEND": "dev-libs/B:*" },
+ #~ "dev-libs/A-5.3": { "EAPI": 3, "DEPEND": "dev-libs/B:*" },
+ #~ "dev-libs/A-5.4": { "EAPI": 4, "DEPEND": "dev-libs/B:*" },
+
+ #EAPI-4: slot operator deps
+ #~ "dev-libs/A-6.0": { "EAPI": 0, "DEPEND": "dev-libs/B[bar(+)]" },
+ #~ "dev-libs/A-6.1": { "EAPI": 1, "DEPEND": "dev-libs/B[bar(+)]" },
+ #~ "dev-libs/A-6.2": { "EAPI": 2, "DEPEND": "dev-libs/B[bar(+)]" },
+ #~ "dev-libs/A-6.3": { "EAPI": 3, "DEPEND": "dev-libs/B[bar(+)]" },
+ #~ "dev-libs/A-6.4": { "EAPI": 4, "DEPEND": "dev-libs/B[bar(+)]" },
+
+ "dev-libs/B-1": {"EAPI": 1, "IUSE": "+foo"},
+ }
+
+ requests = (
+ #~ (["=dev-libs/A-1.0"], {}, None, False, None),
+ (["=dev-libs/A-1.1"], {}, None, True, ["dev-libs/A-1.1"]),
+ (["=dev-libs/A-1.2"], {}, None, True, ["dev-libs/A-1.2"]),
+ (["=dev-libs/A-1.3"], {}, None, True, ["dev-libs/A-1.3"]),
+ #~ (["=dev-libs/A-1.4"], {}, None, True, ["dev-libs/A-1.4"]),
+
+ #~ (["=dev-libs/A-2.0"], {}, None, False, None),
+ (["=dev-libs/A-2.1"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-2.1"]),
+ (["=dev-libs/A-2.2"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-2.2"]),
+ (["=dev-libs/A-2.3"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-2.3"]),
+ #~ (["=dev-libs/A-2.4"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-2.4"]),
+
+ (["=dev-libs/A-3.0"], {}, None, False, None),
+ (["=dev-libs/A-3.1"], {}, None, False, None),
+ (["=dev-libs/A-3.2"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-3.2"]),
+ (["=dev-libs/A-3.3"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-3.3"]),
+ #~ (["=dev-libs/A-3.4"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-3.4"]),
+
+ (["=dev-libs/A-4.0"], {}, None, False, None),
+ (["=dev-libs/A-4.1"], {}, None, False, None),
+ (["=dev-libs/A-4.2"], {}, None, True, ["dev-libs/A-4.2"]),
+ (["=dev-libs/A-4.3"], {}, None, True, ["dev-libs/A-4.3"]),
+ #~ (["=dev-libs/A-4.4"], {}, None, True, ["dev-libs/A-4.4"]),
+
+ #~ (["=dev-libs/A-5.0"], {}, None, False, None),
+ #~ (["=dev-libs/A-5.1"], {}, None, False, None),
+ #~ (["=dev-libs/A-5.2"], {}, None, False, None),
+ #~ (["=dev-libs/A-5.3"], {}, None, False, None),
+ #~ (["=dev-libs/A-5.4"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-5.4"]),
+
+ #~ (["=dev-libs/A-6.0"], {}, None, False, None),
+ #~ (["=dev-libs/A-6.1"], {}, None, False, None),
+ #~ (["=dev-libs/A-6.2"], {}, None, False, None),
+ #~ (["=dev-libs/A-6.3"], {}, None, False, None),
+ #~ (["=dev-libs/A-6.4"], {}, None, True, ["dev-libs/B-1", "dev-libs/A-6.4"]),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds)
+
+ for atoms, options, action, expected_result, expected_mergelist in requests:
+ success, mergelist = playground.run(atoms, options, action)
+ self.assertEqual((success, mergelist), (expected_result, expected_mergelist))
diff --git a/pym/portage/tests/resolver/test_simple.py b/pym/portage/tests/resolver/test_simple.py
index d178e7fb..c092129b 100644
--- a/pym/portage/tests/resolver/test_simple.py
+++ b/pym/portage/tests/resolver/test_simple.py
@@ -27,6 +27,4 @@ class SimpleResolverTestCase(TestCase):
for atoms, options, action, expected_result, expected_mergelist in requests:
success, mergelist = playground.run(atoms, options, action)
- self.assertEqual(success, expected_result)
- if success:
- self.assertEqual(mergelist, expected_mergelist)
+ self.assertEqual((success, mergelist), (expected_result, expected_mergelist))