Enable --autounmask by default
[portage.git] / pym / portage / tests / resolver / test_simple.py
1 # Copyright 2010-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 from portage.tests import TestCase
5 from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase
6
7 class SimpleResolverTestCase(TestCase):
8
9         def testSimple(self):
10                 ebuilds = {
11                         "dev-libs/A-1": { "KEYWORDS": "x86" }, 
12                         "dev-libs/A-2": { "KEYWORDS": "~x86" },
13                         "dev-libs/B-1.2": {},
14
15                         "app-misc/Z-1": { "DEPEND": "|| ( app-misc/Y ( app-misc/X app-misc/W ) )", "RDEPEND": "" },
16                         "app-misc/Y-1": { "KEYWORDS": "~x86" },
17                         "app-misc/X-1": {},
18                         "app-misc/W-1": {},
19                         }
20                 installed = {
21                         "dev-libs/A-1": {},
22                         "dev-libs/B-1.1": {},
23                         }
24
25                 test_cases = (
26                         ResolverPlaygroundTestCase(["dev-libs/A"], success = True, mergelist = ["dev-libs/A-1"]),
27                         ResolverPlaygroundTestCase(["=dev-libs/A-2"], options = { "--autounmask": 'n' }, success = False),
28
29                         ResolverPlaygroundTestCase(
30                                 ["dev-libs/A"],
31                                 options = {"--noreplace": True},
32                                 success = True,
33                                 mergelist = []),
34                         ResolverPlaygroundTestCase(
35                                 ["dev-libs/B"],
36                                 options = {"--noreplace": True},
37                                 success = True,
38                                 mergelist = []),
39                         ResolverPlaygroundTestCase(
40                                 ["dev-libs/B"],
41                                 options = {"--update": True},
42                                 success = True,
43                                 mergelist = ["dev-libs/B-1.2"]),
44
45                         ResolverPlaygroundTestCase(
46                                 ["app-misc/Z"],
47                                 success = True,
48                                 mergelist = ["app-misc/W-1", "app-misc/X-1", "app-misc/Z-1"]),
49                         )
50
51                 playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)
52                 try:
53                         for test_case in test_cases:
54                                 playground.run_TestCase(test_case)
55                                 self.assertEqual(test_case.test_success, True, test_case.fail_msg)
56                 finally:
57                         playground.cleanup()