Skip to content

Commit

Permalink
fix(domain): add tests for failing package.keywords parsing.
Browse files Browse the repository at this point in the history
See #5 ; in tracing the involved code I have
a hard time believing the end result supports incrementalism.

Signed-off-by: Brian Harring <[email protected]>
  • Loading branch information
ferringb committed Feb 5, 2023
1 parent ef721d2 commit d36c824
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/ebuild/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from pkgcore.ebuild import domain as domain_mod
from pkgcore.ebuild import profiles
from pkgcore.ebuild.atom import atom
from pkgcore.fs.livefs import iter_scan
from pkgcore.restrictions import packages

Expand All @@ -22,6 +23,8 @@ def _setup(self, tmp_path_factory):
self.pmixin.mk_profile(self.profile_base, str(self.profile1))
self.pusedir = self.confdir / "package.use"
self.pusedir.mkdir()
self.pkeywordsdir = self.confdir / "package.accept_keywords"
self.pkeywordsdir.mkdir()

def mk_domain(self):
return domain_mod.domain(
Expand Down Expand Up @@ -141,3 +144,24 @@ def test_use_flag_parsing_enforcement(self, caplog):
assert () == self.mk_domain().pkg_use
assert "token x_$z is not a valid use flag" in caplog.text
caplog.clear()

@pytest.mark.xfail(
reason="token awareness isn't yet implemented for package.keywords"
)
def test_package_keywords(self):
(self.pkeywordsdir / "a").write_text(
"""
dev-util/normal x86 ~amd64
# for all of these, verify that it strips the unnecessary tokens.
dev-util/stable x86 *
dev-util/unstable ~* x64
dev-util/always amd64 ** x
"""
)
keys = self.mk_domain().pkg_accept_keywords
assert keys == (
(atom("dev-util/normal"), ("x86", "~amd64")),
(atom("dev-util/test-stable"), ("*",)),
(atom("dev-util/test-unstable"), ("~*")),
(atom("dev-util/test-unstable"), ("**")),
)

0 comments on commit d36c824

Please sign in to comment.