commit:     b98dbb357b711f64c8fc1e305c5bca38be203f1d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 10 01:10:14 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 10 02:24:11 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b98dbb35

test_virtual_w3m: add realistic case, deps copied from real ebuilds

Since virtual/w3m-0 is not removed in the depclean case,
this test fails to reproduce bug 649622.

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

 lib/portage/tests/resolver/test_or_choices.py | 142 ++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/lib/portage/tests/resolver/test_or_choices.py 
b/lib/portage/tests/resolver/test_or_choices.py
index a7ede1fac..f31a5ff22 100644
--- a/lib/portage/tests/resolver/test_or_choices.py
+++ b/lib/portage/tests/resolver/test_or_choices.py
@@ -581,6 +581,148 @@ class OrChoicesTestCase(TestCase):
                        playground.cleanup()
 
 
+       def test_virtual_w3m_realistic(self):
+               """
+               Test for bug 649622 with realistic www-client/w3m dependencies 
copied
+               from real ebuilds.
+               """
+               ebuilds = {
+
+                       'app-misc/neofetch-6.1.0': {
+                               'EAPI': '7',
+                               'RDEPEND': 'www-client/w3m'
+                       },
+
+                       'app-text/xmlto-0.0.28-r1' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( virtual/w3m www-client/lynx 
www-client/elinks )'
+                       },
+
+                       'mail-client/neomutt-20191207': {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/lynx www-client/w3m 
www-client/elinks )'
+                       },
+
+                       'www-client/elinks-0.13_pre_pre20180225' : {
+                               'EAPI': '7',
+                       },
+
+                       'www-client/lynx-2.9.0_pre4' : {
+                               'EAPI': '7',
+                       },
+
+                       'virtual/w3m-0' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/w3m 
www-client/w3mmee )'
+                       },
+
+                       'www-client/w3m-0.5.3_p20190105' : {
+                               'EAPI': '7',
+                       },
+
+                       'www-client/w3mmee-0.3.2_p24-r10' : {
+                               'EAPI': '7',
+                       },
+
+                       'x11-base/xorg-server-1.20.7' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/links 
www-client/lynx www-client/w3m ) app-text/xmlto',
+                       }
+               }
+
+               installed = {
+
+                       'app-misc/neofetch-6.1.0': {
+                               'EAPI': '7',
+                               'RDEPEND': 'www-client/w3m'
+                       },
+
+                       'app-text/xmlto-0.0.28-r1' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( virtual/w3m www-client/lynx 
www-client/elinks )'
+                       },
+
+                       'mail-client/neomutt-20191207': {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/lynx www-client/w3m 
www-client/elinks )'
+                       },
+
+                       'www-client/lynx-2.9.0_pre4' : {
+                               'EAPI': '7',
+                       },
+
+                       'www-client/w3m-0.5.3_p20190105' : {
+                               'EAPI': '7',
+                       },
+
+                       'x11-base/xorg-server-1.20.7' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/links 
www-client/lynx www-client/w3m ) app-text/xmlto',
+                       }
+               }
+
+               world = ['app-misc/neofetch', 'mail-client/neomutt', 
'www-client/lynx', 'x11-base/xorg-server']
+
+               test_cases = (
+
+                       # Test for bug 649622 (with www-client/w3m installed via
+                       # xorg-server dependency), 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=['virtual/w3m-0'],
+                       ),
+
+               )
+
+               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(), {
+
+                       'virtual/w3m-0' : {
+                               'EAPI': '7',
+                               'RDEPEND': '|| ( www-client/w3m 
www-client/w3mmee )'
+                       },
+
+               }.items()))
+
+               test_cases = (
+
+                       # Test for bug 649622, where virtual/w3m is removed by
+                       # emerge --depclean immediately after it's installed
+                       # by a world update. Since virtual/w3m-0 is not removed
+                       # here, this case fails to reproduce bug 649622.
+                       ResolverPlaygroundTestCase(
+                               [],
+                               options={'--depclean': True},
+                               success=True,
+                               cleanlist=[],
+                       ),
+
+               )
+
+               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):

Reply via email to