commit:     e5878170638a091db1331df7e7922c8a14e29e86
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 21 01:59:30 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 21 02:35:43 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5878170

Add unit test which demonstrates bug 705986

This USE suggestion appears to prevent application of || preference
adjustment to solve the cycle (pypy-exe-bin would solve it):

 * Error: circular dependencies:

(dev-python/pypy-exe-7.3.0:7.3.0/7.3.0::test_repo, ebuild scheduled for merge) 
depends on
 (dev-python/pypy-7.3.0:0/73::test_repo, ebuild scheduled for merge) (buildtime)
  (dev-python/pypy-exe-7.3.0:7.3.0/7.3.0::test_repo, ebuild scheduled for 
merge) (buildtime)

It might be possible to break this cycle
by applying the following change:
- dev-python/pypy-exe-7.3.0 (Change USE: +low-memory)

Meanwhile, an explicit pypy-exe-bin argument adjusts the || preference
and breaks the cycle:

$ emerge -pq pypy pypy-exe-bin
[ebuild  N     ] dev-python/pypy-exe-bin-7.3.0
[ebuild  N     ] dev-python/pypy-7.3.0

Bug: https://bugs.gentoo.org/705986
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .../tests/resolver/test_circular_choices.py        | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/lib/portage/tests/resolver/test_circular_choices.py 
b/lib/portage/tests/resolver/test_circular_choices.py
index a5c10b476..968677a46 100644
--- a/lib/portage/tests/resolver/test_circular_choices.py
+++ b/lib/portage/tests/resolver/test_circular_choices.py
@@ -160,3 +160,51 @@ class VirtualCircularChoicesTestCase(TestCase):
                                self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
                finally:
                        playground.cleanup()
+
+
+class CircularPypyExeTestCase(TestCase):
+       def testCircularPypyExe(self):
+
+               ebuilds = {
+                       'dev-python/pypy-7.3.0': {
+                               'EAPI': '7',
+                               'SLOT' : '0/73',
+                               'DEPEND': '|| ( dev-python/pypy-exe 
dev-python/pypy-exe-bin )'
+                       },
+                       'dev-python/pypy-exe-7.3.0': {
+                               'EAPI': '7',
+                               'IUSE': 'low-memory',
+                               'SLOT' : '7.3.0',
+                               'BDEPEND': '!low-memory? ( dev-python/pypy )'
+                       },
+                       'dev-python/pypy-exe-bin-7.3.0': {
+                               'EAPI': '7',
+                               'SLOT' : '7.3.0',
+                       },
+               }
+
+               test_cases = (
+                       # Demonstrate bug 705986, where a USE change suggestion 
is given
+                       # even though an || preference adjustment is available.
+                       ResolverPlaygroundTestCase(
+                               ['dev-python/pypy'],
+                               circular_dependency_solutions = 
{'dev-python/pypy-7.3.0': {frozenset({('low-memory', True)})}},
+                               success = False,
+                       ),
+                       # Demonstrate explicit pypy-exe-bin argument used as a 
workaround
+                       # for bug 705986.
+                       ResolverPlaygroundTestCase(
+                               ['dev-python/pypy', 'dev-python/pypy-exe-bin'],
+                               mergelist=['dev-python/pypy-exe-bin-7.3.0', 
'dev-python/pypy-7.3.0'],
+                               success = True,
+                       ),
+               )
+
+               playground = ResolverPlayground(ebuilds=ebuilds, 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()

Reply via email to