diff options
author | Brian Harring <ferringb@gmail.com> | 2022-12-25 17:31:02 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-12-26 19:27:24 +0200 |
commit | 5a51817e29ee8a9879876be1576eaa38b357ffa3 (patch) | |
tree | c796f66d3014c48895fd952d9ad715cf98ac1518 /tests | |
parent | Expand EAPI object declarations of support, wire atom to use it. (diff) | |
download | pkgcore-5a51817e29ee8a9879876be1576eaa38b357ffa3.tar.gz pkgcore-5a51817e29ee8a9879876be1576eaa38b357ffa3.tar.bz2 pkgcore-5a51817e29ee8a9879876be1576eaa38b357ffa3.zip |
Add use flag validation for /etc/portage/package.use/* content.
Had this been in place, it would've detected pkgcore/pkgcore#384 long ago.
Signed-off-by: Brian Harring <ferringb@gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ebuild/test_domain.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/ebuild/test_domain.py b/tests/ebuild/test_domain.py index 87c3d489f..90594b9d6 100644 --- a/tests/ebuild/test_domain.py +++ b/tests/ebuild/test_domain.py @@ -20,6 +20,8 @@ class TestDomain: self.profile_base = tmp_path_factory.mktemp("profiles") self.profile1 = self.profile_base / "profile1" self.pmixin.mk_profile(self.profile_base, str(self.profile1)) + self.pusedir = self.confdir / "package.use" + self.pusedir.mkdir() def mk_domain(self): return domain_mod.domain( @@ -32,14 +34,11 @@ class TestDomain: def test_sorting(self): """assert that configuration files are read in alphanum ordering""" - cdir = self.confdir / "package.use" - cdir.mkdir() - # assert the base state; no files, no content. assert () == self.mk_domain().pkg_use - open(cdir / "00", "w").write("*/* X") - open(cdir / "01", "w").write("*/* -X Y") + open(self.pusedir / "00", "w").write("*/* X") + open(self.pusedir / "01", "w").write("*/* -X Y") # Force the returned ordering to be reversed; this is to assert that # the domain forces a sort. @@ -57,9 +56,7 @@ class TestDomain: ) == self.mk_domain().pkg_use def test_use_expand_syntax(self): - puse = self.confdir / "package.use" - puse.mkdir() - open(puse / "a", "w").write( + open(self.pusedir / "a", "w").write( textwrap.dedent( """ */* x_y1 @@ -82,3 +79,9 @@ class TestDomain: ), ), ) == self.mk_domain().pkg_use + + def test_use_flag_parsing_enforcement(self): + open(self.pusedir / "a", "w").write("*/* X:") + # TODO: need to catch the warning here, but I'm not sure how. + # Meanwhile, ensure that the failed token is ignored. + assert ((packages.AlwaysTrue, ((), ())),) == self.mk_domain().pkg_use |