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

Louis Chauvet <[email protected]> Wed, 17 Dec 2025 08:10:15 +0100
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <20251217-add_package_license_to_profiles-v1-4-4bf9be62e3d9@bootlin.com>
Now package.license can be read from profiles, add two tests to ensure that
user and profile configuration are properly read.

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": {},

-- 
2.51.2