blob: 8b4f7ec5c0a8963d51eb4976859b4ed059b6048b (
plain)
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
|
from pkgcore.pkgsets import installed
from pkgcore.repository.util import SimpleTree
class FakePkg:
package_is_real = True
is_supported = True
def __init__(self, cat, pn, ver):
self.cat = cat
self.pn = pn
self.ver = ver
@property
def slotted_atom(self):
return f"{self.cat}/{self.pn}"
@property
def versioned_atom(self):
return f"{self.cat}/{self.pn}-{self.ver}"
class TestInstalled:
def test_iter(self):
fake_vdb = SimpleTree(
{
"dev-util": {
"diffball": ["1.0"],
"bsdiff": ["1.2", "1.3"],
}
},
pkg_klass=FakePkg,
)
assert set(installed.Installed([fake_vdb])) == {
"dev-util/diffball",
"dev-util/bsdiff",
}
assert set(installed.VersionedInstalled([fake_vdb])) == {
"dev-util/diffball-1.0",
"dev-util/bsdiff-1.2",
"dev-util/bsdiff-1.3",
}
|