MCPcopy Create free account
hub / github.com/archlinux/alpm / test_from_file_valid

Function test_from_file_valid

python-alpm/tests/srcinfo/test_source_info.py:66–78  ·  view source on GitHub ↗

Test parsing SRCINFO from file with explicit schema.

(
    full_version: FullVersion,
    valid_srcinfo_content: str,
    schema: SourceInfoSchema | None,
)

Source from the content-addressed store, hash-verified

64
65@pytest.mark.parametrize("schema", [None, SourceInfoSchema("1")])
66def test_from_file_valid(
67 full_version: FullVersion,
68 valid_srcinfo_content: str,
69 schema: SourceInfoSchema | None,
70) -> None:
71 """Test parsing SRCINFO from file with explicit schema."""
72 with tempfile.NamedTemporaryFile(mode="w", suffix=".SRCINFO", delete=True) as tmp:
73 tmp.write(valid_srcinfo_content)
74 tmp.flush()
75
76 result = source_info_from_file(tmp.name, schema)
77 assert type(result) is SourceInfoV1
78 assert result.base.version == full_version
79
80
81def test_from_file_path_object(

Callers

nothing calls this directly

Calls 3

source_info_from_fileFunction · 0.85
writeMethod · 0.80
flushMethod · 0.80

Tested by

no test coverage detected