commit:     c3e9a0fe26434edcc2c034c6b863789eb6afbc34
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  9 23:53:42 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb  9 23:56:16 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c3e9a0fe

test_virtual_w3m: test without www-client/w3m installed

Add test case showing that virtual/w3m-0 is not pulled in when
www-client/w3m is not installed and not in @world.

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

 lib/portage/tests/resolver/test_or_choices.py | 39 +++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/lib/portage/tests/resolver/test_or_choices.py 
b/lib/portage/tests/resolver/test_or_choices.py
index a295c9a22..a7ede1fac 100644
--- a/lib/portage/tests/resolver/test_or_choices.py
+++ b/lib/portage/tests/resolver/test_or_choices.py
@@ -455,18 +455,47 @@ class OrChoicesTestCase(TestCase):
                                'EAPI': '7',
                        },
 
+               }
+
+               world = ['app-text/xmlto', 'www-client/elinks', 
'www-client/lynx']
+
+               test_cases = (
+
+                       # Test for bug 649622 (without www-client/w3m 
installed),
+                       # where virtual/w3m was pulled in only to be removed by 
the
+                       # next emerge --depclean.
+                       ResolverPlaygroundTestCase(
+                               ['@world'],
+                               options = {'--update': True, '--deep': True},
+                               success = True,
+                               mergelist = []
+                       ),
+
+               )
+
+               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 = dict(itertools.chain(installed.items(), {
+
                        'www-client/w3m-0.5.3_p20190105' : {
                                'EAPI': '7',
                        },
 
-               }
-
-               world = ['app-text/xmlto', 'www-client/elinks', 
'www-client/lynx']
+               }.items()))
 
                test_cases = (
 
-                       # Test for bug 649622, where virtual/w3m was pulled in 
only
-                       # to be removed by the next emerge --depclean.
+                       # Test for bug 649622 (with www-client/w3m installed),
+                       # where virtual/w3m was pulled in only to be removed by 
the
+                       # next emerge --depclean.
                        ResolverPlaygroundTestCase(
                                ['@world'],
                                options = {'--update': True, '--deep': True},

Reply via email to