diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-08-27 09:02:50 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-27 08:42:07 -0700 |
commit | a569acee165f2533c15322e8e0c33f322baae9f2 (patch) | |
tree | 4b3f6bd5d3dabc44367716aa419d5665bad77d4a /pym/portage/tests | |
parent | 58d259d79a2d15a1dff1a90ff066615318b35917 (diff) | |
download | portage-a569acee165f2533c15322e8e0c33f322baae9f2.tar.gz portage-a569acee165f2533c15322e8e0c33f322baae9f2.tar.bz2 portage-a569acee165f2533c15322e8e0c33f322baae9f2.zip |
config: Avoid copying _license_manager
Strictly speaking _license_manager is not immutable. Users need to ensure that
extract_global_changes() is called right after __init__ (if at all).
It also has the mutable member _undef_lic_groups. It is used to track
undifiend license groups, to not display an error message for the same
group again and again. Because of this, it's useful to share it between
all LicenseManager instances.
Diffstat (limited to 'pym/portage/tests')
-rw-r--r-- | pym/portage/tests/ebuild/test_config.py | 16 | ||||
-rw-r--r-- | pym/portage/tests/resolver/ResolverPlayground.py | 7 |
2 files changed, 7 insertions, 16 deletions
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py index 6b655daf0..f48717d4f 100644 --- a/pym/portage/tests/ebuild/test_config.py +++ b/pym/portage/tests/ebuild/test_config.py @@ -1,11 +1,8 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -import copy - import portage from portage import os -from portage.dep import ExtendedAtomDict from portage.package.ebuild.config import config from portage.package.ebuild._config.LicenseManager import LicenseManager from portage.tests import TestCase @@ -60,26 +57,15 @@ class ConfigTestCase(TestCase): license_group_locations = (os.path.join(playground.portdir, "profiles"),) pkg_license = os.path.join(playground.eroot, "etc", "portage") - lic_man = LicenseManager() - - lic_man.parse_license_groups(license_group_locations) - lic_man.read_config_files(pkg_license) - lic_man_backup = copy.deepcopy(lic_man) + lic_man = LicenseManager(license_group_locations, pkg_license) self.assertEqual(lic_man._accept_license_str, None) - self.assertEqual(lic_man._accept_license_str, lic_man_backup._accept_license_str) self.assertEqual(lic_man._accept_license, None) - self.assertEqual(lic_man._accept_license, lic_man_backup._accept_license) self.assertEqual(lic_man._license_groups, {"EULA": ["TEST"]}) - self.assertEqual(lic_man._license_groups, lic_man_backup._license_groups) - self.assertEqual(lic_man._plicensedict, lic_man_backup._plicensedict) self.assertEqual(lic_man._undef_lic_groups, set(["TEST"])) - self.assertEqual(lic_man._undef_lic_groups, lic_man_backup._undef_lic_groups) self.assertEqual(lic_man.extract_global_changes(), "TEST TEST2") self.assertEqual(lic_man.extract_global_changes(), "") - self.assertEqual(lic_man_backup.extract_global_changes("TEST3 TEST4"), "TEST3 TEST4 TEST TEST2") - self.assertEqual(lic_man_backup.extract_global_changes("TEST3 TEST4"), "TEST3 TEST4") lic_man.set_accept_license_str("TEST TEST2") self.assertEqual(lic_man._getPkgAcceptLicense("dev-libs/B-1", "0"), ["TEST", "TEST2", "TEST"]) diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 952a5f265..f7707b5ea 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -46,6 +46,9 @@ class ResolverPlayground(object): os.makedirs(self.portdir) os.makedirs(self.vdbdir) + if not debug: + portage.util.noiselimit = -2 + self._create_ebuilds(ebuilds) self._create_installed(installed) self._create_profile(ebuilds, installed, profile, user_config, sets) @@ -54,6 +57,8 @@ class ResolverPlayground(object): self.settings, self.trees = self._load_config() self._create_ebuild_manifests(ebuilds) + + portage.util.noiselimit = 0 def _create_ebuilds(self, ebuilds): for cpv in ebuilds: @@ -205,7 +210,7 @@ class ResolverPlayground(object): if profile: #This is meant to allow the consumer to set up his own profile, #with package.mask and what not. - raise NotImplentedError() + raise NotImplementedError() #Create profile symlink os.makedirs(os.path.join(self.eroot, "etc")) |