diff options
author | Brian Harring <ferringb@gmail.com> | 2023-11-20 18:31:36 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-12-03 07:18:35 +0200 |
commit | 323148b8c9b43d631ac0a18bf3a6beac43d807d2 (patch) | |
tree | fc174b09d0322f3ebcfe25bdf9d174e0a62f719d /src | |
parent | pquery: Fix --environment-re support . (diff) | |
download | pkgcore-323148b8c9b43d631ac0a18bf3a6beac43d807d2.tar.gz pkgcore-323148b8c9b43d631ac0a18bf3a6beac43d807d2.tar.bz2 pkgcore-323148b8c9b43d631ac0a18bf3a6beac43d807d2.zip |
cleanup: Replace fake_pkg with common mock
Signed-off-by: Brian Harring <ferringb@gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pkgcore/test/misc.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkgcore/test/misc.py b/src/pkgcore/test/misc.py index 20c8e6fe..3a001176 100644 --- a/src/pkgcore/test/misc.py +++ b/src/pkgcore/test/misc.py @@ -109,6 +109,10 @@ class FakeEbuildRepo(FakeRepo): class FakePkg(FakePkgBase): + """ + Object used to mock an ebuild instance for test usage. + """ + def __init__( self, cpv, @@ -140,6 +144,11 @@ class FakePkg(FakePkgBase): if iuse is not None: object.__setattr__(self, "iuse", set(iuse)) + @classmethod + def for_tree_usage(cls, cat: str, pkg: str, version: str, **kwargs): + """Helper function that can be used by repository classes""" + return cls(f"{cat}/{pkg}-{version}", **kwargs) + # misc setup code for generating glsas for testing |