Update PackageManager method names
This commit is contained in:
parent
054f7a8a8e
commit
77b810b5a6
@ -43,11 +43,7 @@ class PackageManager:
|
|||||||
self._db_path = Path(db_path)
|
self._db_path = Path(db_path)
|
||||||
self._pkglist_cmd = pkglist_cmd
|
self._pkglist_cmd = pkglist_cmd
|
||||||
|
|
||||||
def __init_subclass__(cls, cachedir, db_path, pkglist_cmd):
|
def gen_pkglist(self):
|
||||||
"""Default constructor for all child classes."""
|
|
||||||
super().__init_subclass(cachedir, db_path, pkglist_cmd)
|
|
||||||
|
|
||||||
def _gen_pkglist(self):
|
|
||||||
"""Generate a text file listing installed packages
|
"""Generate a text file listing installed packages
|
||||||
on the system and return the path to that file.
|
on the system and return the path to that file.
|
||||||
|
|
||||||
@ -74,7 +70,7 @@ class PackageManager:
|
|||||||
syslog.info("Package list generation complete")
|
syslog.info("Package list generation complete")
|
||||||
return Path(pkglist.name)
|
return Path(pkglist.name)
|
||||||
|
|
||||||
def _gen_db_archive(self, *args, **kwargs):
|
def gen_db_archive(self, compress=None):
|
||||||
"""Generate a database archive for this package manager.
|
"""Generate a database archive for this package manager.
|
||||||
|
|
||||||
Note that this method is internal and is
|
Note that this method is internal and is
|
||||||
|
@ -102,7 +102,7 @@ class TestPackageManagerMethods(unittest.TestCase):
|
|||||||
self.mocked_run.return_value.stdout = "packages"
|
self.mocked_run.return_value.stdout = "packages"
|
||||||
self.mocked_tempfile.return_value.name = "tempfile"
|
self.mocked_tempfile.return_value.name = "tempfile"
|
||||||
|
|
||||||
pkglist = self.p._gen_pkglist()
|
pkglist = self.p.gen_pkglist()
|
||||||
|
|
||||||
self.mocked_tempfile.return_value.__enter__.return_value.write.assert_called_with(
|
self.mocked_tempfile.return_value.__enter__.return_value.write.assert_called_with(
|
||||||
"packages"
|
"packages"
|
||||||
@ -112,7 +112,7 @@ class TestPackageManagerMethods(unittest.TestCase):
|
|||||||
def test_pkglist_subprocess_error(self):
|
def test_pkglist_subprocess_error(self):
|
||||||
self.mocked_run.side_effect = subprocess.CalledProcessError(1, self.pkglist_cmd)
|
self.mocked_run.side_effect = subprocess.CalledProcessError(1, self.pkglist_cmd)
|
||||||
|
|
||||||
self.p._gen_pkglist()
|
self.p.gen_pkglist()
|
||||||
self.mocked_tempfile.assert_not_called()
|
self.mocked_tempfile.assert_not_called()
|
||||||
|
|
||||||
def test_db_archive(self):
|
def test_db_archive(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user