commit: 1419af8b0830af4a93adda4a4b63d6bba8f3deb6 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Fri Jan 31 03:25:26 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sat Feb 1 04:47:36 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1419af8b
Add test case that demonstrates bug 707108 Bug: https://bugs.gentoo.org/707108 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/tests/resolver/test_or_choices.py | 123 ++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index a50ad0151..78946ccec 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -285,6 +285,129 @@ class OrChoicesTestCase(TestCase): playground.debug = False playground.cleanup() + def test_python_slot(self): + ebuilds = { + + "dev-lang/python-3.8" : { + "EAPI": "7", + "SLOT": "3.8" + }, + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "dev-lang/python-3.6" : { + "EAPI": "7", + "SLOT": "3.6" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "RDEPEND": "python_targets_python3_7? ( dev-lang/python:3.7 ) python_targets_python3_6? ( dev-lang/python:3.6 )" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + installed = { + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "USE": "python_targets_python3_7", + "RDEPEND": "dev-lang/python:3.7" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + world = ["app-misc/foo", "app-misc/bar"] + + test_cases = ( + + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = ['dev-lang/python-3.8'] + ), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + 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() + + installed = { + + "dev-lang/python-3.8" : { + "EAPI": "7", + "SLOT": "3.8" + }, + + "dev-lang/python-3.7" : { + "EAPI": "7", + "SLOT": "3.7" + }, + + "app-misc/bar-1" : { + "EAPI": "7", + "IUSE": "python_targets_python3_6 +python_targets_python3_7", + "USE": "python_targets_python3_7", + "RDEPEND": "dev-lang/python:3.7" + }, + + "app-misc/foo-1" : { + "EAPI": "7", + "RDEPEND": "|| ( dev-lang/python:3.8 dev-lang/python:3.7 dev-lang/python:3.6 )" + }, + + } + + test_cases = ( + # Demonstrate bug 707108, where a new python slot is erroneosly + # removed by emerge --depclean. + ResolverPlaygroundTestCase( + [], + options={"--depclean": True}, + success=True, + cleanlist=['dev-lang/python-3.8'], + ), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, world=world, debug=False) + 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() + + class OrChoicesLibpostprocTestCase(TestCase): def testOrChoicesLibpostproc(self):