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:
Caleb Connolly 2024-10-24 00:17:00 +02:00
parent 511d490015
commit b9354d3ccd
No known key found for this signature in database
GPG key ID: 0583312B195F64B6
3 changed files with 217 additions and 0 deletions

View file

@ -2,6 +2,7 @@ import os
from pathlib import Path
import pytest
import shutil
import tempfile
import pmb.core
from pmb.core.context import get_context
@ -165,3 +166,8 @@ def pmaports(pmb_args, monkeypatch):
pmb.helpers.git.clone("pmaports")
assert pmb.helpers.run.user(["git", "checkout", "master"], working_dir=config.aports[0]) == 0
@pytest.fixture
def tmp_file(tmp_path):
return Path(tempfile.mkstemp(dir=tmp_path)[1])