Re: [PATCH RESEND 4/4] tests/test_config: Add test for package.license in profiles

Sam James <[email protected]> Thu, 18 Dec 2025 01:28:11 +0000
Newsgroups gmane.linux.gentoo.portage.devel
Organization Gentoo
Message-ID <[email protected]>
Louis Chauvet <[email protected]> writes:

> Now package.license can be read from profiles, add two tests to ensure that
> user and profile configuration are properly read.

Reviewed-by: Sam James <[email protected]>

>
> Signed-off-by: Louis Chauvet <[email protected]>
> ---
>  lib/portage/tests/ebuild/test_config.py | 37 +++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>
> diff --git a/lib/portage/tests/ebuild/test_config.py b/lib/portage/tests/ebuild/test_config.py
> index b36073504b11..43940987254b 100644
> --- a/lib/portage/tests/ebuild/test_config.py
> +++ b/lib/portage/tests/ebuild/test_config.py
> @@ -185,6 +185,43 @@ class ConfigTestCase(TestCase):
>              portage.util.noiselimit = 0
>              playground.cleanup()
>  
> +    def testLicenseManagerProfile(self):
> +        profile_config = {
> +            "package.license": self._testLicenseManagerPackageLicense,
> +        }
> +
> +        playground = ResolverPlayground(profile=profile_config)
> +        settings = config(clone=playground.settings)
> +        try:
> +            portage.util.noiselimit = -2
> +
> +            lic_man = LicenseManager(settings._locations_manager)
> +            self._testLicenseManager(lic_man)
> +
> +        finally:
> +            portage.util.noiselimit = 0
> +            playground.cleanup()
> +
> +    def testLicenseManagerMixed(self):
> +        profile_config = {
> +            "package.license": self._testLicenseManagerPackageLicense[:4],
> +        }
> +        user_config = {
> +            "package.license": self._testLicenseManagerPackageLicense[4:],
> +        }
> +
> +        playground = ResolverPlayground(user_config=user_config, profile=profile_config)
> +        settings = config(clone=playground.settings)
> +        try:
> +            portage.util.noiselimit = -2
> +
> +            lic_man = LicenseManager(settings._locations_manager)
> +            self._testLicenseManager(lic_man)
> +
> +        finally:
> +            portage.util.noiselimit = 0
> +            playground.cleanup()
> +
>      def testPackageMaskOrder(self):
>          ebuilds = {
>              "dev-libs/A-1": {},