forked from Mirror/pmbootstrap
test: parse: add test_deviceinfo (MR 2453)
Write some basic parser tests for deviceinfo. The parser is quite basic so there isn't much to test yet. Expecting this to gain features as we look at e.g. making the parser the "source of truth" for the deviceinfo format. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
511d490015
commit
b9354d3ccd
3 changed files with 217 additions and 0 deletions
|
@ -35,6 +35,13 @@ def _parse_kernel_suffix(info, device, kernel):
|
|||
"b": "second",
|
||||
"b_downstream": "third"}
|
||||
"""
|
||||
# We don't support parsing the kernel variants in tests yet, since this code
|
||||
# depends on pmaports being available and calls into a whole lot of other code.
|
||||
if os.environ.get("PYTEST_CURRENT_TEST", "").startswith("pmb/parse/test_deviceinfo.py"):
|
||||
# If you hit this, you're probably trying to add a test for kernel variants.
|
||||
# You'll need to figure out how to mock the APKBUILD parsing below.
|
||||
assert kernel is None
|
||||
return info
|
||||
# Do nothing if the configured kernel isn't available in the kernel (e.g.
|
||||
# after switching from device with multiple kernels to device with only one
|
||||
# kernel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue