1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# Copyright 2012-2018 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 TestDepend(TestCase):
ebuilds = {
"dev-libs/A-1" : {
"IUSE": "test",
"DEPEND": "test? ( dev-libs/B )",
},
"dev-libs/B-1" : {
},
}
installed = {
"dev-libs/A-1" : {
"USE": "",
"IUSE": "test",
"DEPEND": "test? ( dev-libs/B )",
},
}
def test_default_use_test(self):
"""
Test that FEATURES=test enables USE=test by default.
"""
user_config = {
"make.conf" : ("FEATURES=test", "USE=\"\"")
}
test_case = ResolverPlaygroundTestCase(
["dev-libs/A"],
options = {},
success = True,
mergelist = ["dev-libs/B-1", "dev-libs/A-1"])
playground = ResolverPlayground(ebuilds=self.ebuilds,
user_config=user_config, debug=False)
try:
playground.run_TestCase(test_case)
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
def test_no_forced_use_test(self):
"""
Test that FEATURES=test no longer forces USE=test.
"""
user_config = {
"make.conf" : ("FEATURES=test", "USE=\"-test\"")
}
test_case = ResolverPlaygroundTestCase(
["dev-libs/A"],
options = {},
success = True,
mergelist = ["dev-libs/A-1"])
playground = ResolverPlayground(ebuilds=self.ebuilds,
user_config=user_config, debug=False)
try:
playground.run_TestCase(test_case)
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
def test_newuse(self):
"""
Test that --newuse now detects USE=test changes.
"""
user_config = {
"make.conf" : ("FEATURES=test", "USE=\"\"")
}
test_case = ResolverPlaygroundTestCase(
["dev-libs/A"],
options = {"--newuse": True, "--selective": True},
success = True,
mergelist = ["dev-libs/B-1", "dev-libs/A-1"])
playground = ResolverPlayground(ebuilds=self.ebuilds,
user_config=user_config, debug=False)
try:
playground.run_TestCase(test_case)
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
|