aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pmaint.py8
-rw-r--r--tests/scripts/test_pquery.py33
2 files changed, 34 insertions, 7 deletions
diff --git a/tests/scripts/test_pmaint.py b/tests/scripts/test_pmaint.py
index 2cdb3009b..b4dc48cee 100644
--- a/tests/scripts/test_pmaint.py
+++ b/tests/scripts/test_pmaint.py
@@ -40,7 +40,9 @@ class FakeRepo(util.SimpleTree):
self.installed = []
self.replaced = []
self.uninstalled = []
- super().__init__(data, pkg_klass=partial(FakePkg.for_tree_usage, repo=self), repo_id=repo_id)
+ super().__init__(
+ data, pkg_klass=partial(FakePkg.for_tree_usage, repo=self), repo_id=repo_id
+ )
self.livefs = livefs
self.frozen = frozen
@@ -250,7 +252,9 @@ class TestCopy(ArgParseMixin):
),
)
assert ret == 0, "expected non zero exit code"
- assert [pkg.cpvstr for pkg in config.target_repo.installed] == ["sys-apps/portage-2.3"]
+ assert [pkg.cpvstr for pkg in config.target_repo.installed] == [
+ "sys-apps/portage-2.3"
+ ]
assert (
config.target_repo.uninstalled == config.target_repo.replaced
), "uninstalled should be the same as replaced; empty"
diff --git a/tests/scripts/test_pquery.py b/tests/scripts/test_pquery.py
index c2e7dc992..c36e9f7c3 100644
--- a/tests/scripts/test_pquery.py
+++ b/tests/scripts/test_pquery.py
@@ -1,8 +1,9 @@
from pkgcore.config import basics
from pkgcore.config.hint import ConfigHint, configurable
-from pkgcore.ebuild import atom
+from pkgcore.ebuild import atom, cpv
from pkgcore.repository import util
from pkgcore.scripts import pquery
+from pkgcore.test.misc import FakePkg
from pkgcore.test.scripts.helpers import ArgParseMixin
@@ -19,7 +20,9 @@ class FakeDomain:
@configurable(typename="repo")
def fake_repo():
- return util.SimpleTree({"spork": {"foon": ("1", "2")}})
+ return util.SimpleTree(
+ {"spork": {"foon": ("1", "2")}}, pkg_klass=FakePkg.for_tree_usage
+ )
@configurable(typename="repo")
@@ -53,10 +56,30 @@ class TestCommandline(ArgParseMixin):
"--all",
)
- def test_no_description(self):
+ def test_missing_metadata(self):
+ simple_repo_config = basics.HardCodedConfigSection(
+ {
+ "class": FakeDomain,
+ "repos": [
+ basics.HardCodedConfigSection(
+ # note we're using a raw CPV; this is to remove all metadata attributes and force pquery
+ # to display its behaviour for missing.
+ {
+ "class": configurable(typename="repo")(
+ lambda: util.SimpleTree(
+ {"abc": {"def": ["2"]}}, pkg_klass=cpv.VersionedCPV
+ )
+ )
+ }
+ )
+ ],
+ "vdb": [basics.HardCodedConfigSection({"class": fake_vdb})],
+ "default": True,
+ }
+ )
self.assertOut(
[
- " * spork/foon-2",
+ " * abc/def-2",
" repo: MISSING",
" description: MISSING",
" homepage: MISSING",
@@ -66,7 +89,7 @@ class TestCommandline(ArgParseMixin):
"-v",
"--max",
"--all",
- test_domain=domain_config,
+ test_domain=simple_repo_config,
)
def test_atom(self):