WIP: test: type annotate suffix + pathlib (MR 2252)

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-03-13 02:31:01 +00:00 committed by Oliver Smith
parent 9301412f90
commit 3bfc6474bb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
38 changed files with 164 additions and 128 deletions

View file

@ -1,5 +1,6 @@
# Copyright 2023 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.core.types import PmbArgs
import pytest
import sys
@ -12,13 +13,13 @@ def args(request):
import pmb.parse
sys.argv = ["pmbootstrap", "init"]
args = pmb.parse.arguments()
args.log = args.work + "/log_testsuite.txt"
args.log = pmb.config.work / "log_testsuite.txt"
pmb.helpers.logging.init(args)
request.addfinalizer(pmb.helpers.logging.logfd.close)
return args
def test_filter_missing_packages_invalid(args):
def test_filter_missing_packages_invalid(args: PmbArgs):
""" Test ...repo_missing.filter_missing_packages(): invalid package """
func = pmb.helpers.repo_missing.filter_missing_packages
with pytest.raises(RuntimeError) as e:
@ -26,7 +27,7 @@ def test_filter_missing_packages_invalid(args):
assert str(e.value).startswith("Could not find aport")
def test_filter_missing_packages_binary_exists(args):
def test_filter_missing_packages_binary_exists(args: PmbArgs):
""" Test ...repo_missing.filter_missing_packages(): binary exists """
func = pmb.helpers.repo_missing.filter_missing_packages
assert func(args, "armhf", ["busybox"]) == []
@ -48,7 +49,7 @@ def test_filter_missing_packages_pmaports(args: PmbArgs, monkeypatch):
assert func(args, "x86_64", ["busybox", "hello-world"]) == []
def test_filter_aport_packages(args):
def test_filter_aport_packages(args: PmbArgs):
""" Test ...repo_missing.filter_aport_packages() """
func = pmb.helpers.repo_missing.filter_aport_packages
assert func(args, "armhf", ["busybox", "hello-world"]) == ["hello-world"]