portage_testables: Add Package.package_info.
PackageInfo objects are preferred over the CPV objects they're
replacing. Add new property and note deprecation in cpv.
BUG=None
TEST=./run_pytest
Change-Id: I2fcc2fd29db808de397b808bb25e317220cfed29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2585568
Tested-by: Alex Klein <saklein@chromium.org>
Auto-Submit: Alex Klein <saklein@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/test/portage_testables.py b/test/portage_testables.py
index 7bd1789..5e78dba 100644
--- a/test/portage_testables.py
+++ b/test/portage_testables.py
@@ -300,10 +300,18 @@
@property
def cpv(self) -> package_info.CPV:
- """Returns a CPV object constructed from this package's metadata."""
+ """Returns a CPV object constructed from this package's metadata.
+
+ Deprecated, use package_info instead.
+ """
return package_info.SplitCPV(self.category + '/' + self.package + '-' +
self.version)
+ @property
+ def package_info(self) -> package_info.PackageInfo:
+ """Returns a PackageInfo object constructed from this package's metadata."""
+ return package_info.parse(f'{self.category}/{self.package}-{self.version}')
+
def format_eclass_line(self) -> str:
"""Returns a string containing this package's eclass inheritance line."""
if self.inherit and isinstance(self.inherit, str):