aboutsummaryrefslogtreecommitdiff
blob: a89ebdb672347e3069a78d79ccf2fb0700fe0dbe (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
46
47
48
49
50
51
# Copyright 2021 Gentoo Authors
# 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 UnnecessarySlotrUpgradeTestCase(TestCase):
    def testUnnecessarySlotUpgrade(self):
        ebuilds = {
            "app-misc/a-1": {
                "EAPI": "8",
                "RDEPEND": "|| ( dev-lang/python:3.10 dev-lang/python:3.9 ) || ( dev-lang/python:3.10 dev-lang/python:3.9 )",
            },
            "dev-lang/python-3.9": {"SLOT": "3.9"},
            "dev-lang/python-3.10": {"SLOT": "3.10"},
        }

        installed = {
            "dev-lang/python-3.9": {"SLOT": "3.9"},
        }

        test_cases = (
            # Test bug 828136, where an unnecessary python slot upgrade
            # was triggered.
            ResolverPlaygroundTestCase(
                [
                    "app-misc/a",
                ],
                success=True,
                mergelist=(
                    "dev-lang/python-3.10",
                    "app-misc/a-1",
                ),
            ),
        )

        playground = ResolverPlayground(
            debug=False, ebuilds=ebuilds, installed=installed
        )

        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.debug = False
            playground.cleanup()