test: move all tests into separate module (MR 2551)

When installing pmboostrap, all tests are installed alongside it. There
doesn't seem to be any way to selectively exclude some files inside
python modules, so move all test into a separate module instead.

This is the typical convention in python projects.

See: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/79862
Fixes: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2541
This commit is contained in:
Hugo Osvaldo Barrera 2025-02-13 01:24:39 +01:00
parent c2bcc81589
commit 5a152aebae
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
16 changed files with 11 additions and 11 deletions

View file

@ -4,7 +4,7 @@
from pmb.types import Bootimg from pmb.types import Bootimg
import pytest import pytest
from .device import generate_deviceinfo_fastboot_content from pmb.aportgen.device import generate_deviceinfo_fastboot_content
# Test case name -> (input, expected substrings, !expected substrings) # Test case name -> (input, expected substrings, !expected substrings)
test_data: dict[str, tuple[Bootimg | None, list[str], list[str]]] = { test_data: dict[str, tuple[Bootimg | None, list[str], list[str]]] = {

View file

@ -9,7 +9,7 @@ from pmb.core.arch import Arch
from pmb.core.context import get_context from pmb.core.context import get_context
from pmb.parse.apkindex import ApkindexBlock from pmb.parse.apkindex import ApkindexBlock
from .apk import packages_get_locally_built_apks from pmb.chroot.apk import packages_get_locally_built_apks
import pmb.config.pmaports import pmb.config.pmaports

View file

@ -6,7 +6,7 @@ from pathlib import Path
from typing import Any from typing import Any
import pytest import pytest
from .arch import Arch from pmb.core.arch import Arch
def test_valid_arches(): def test_valid_arches():

View file

@ -3,9 +3,9 @@
import pytest import pytest
from .arch import Arch from pmb.core.arch import Arch
from .context import get_context from pmb.core.context import get_context
from .chroot import Chroot, ChrootType from pmb.core.chroot import Chroot, ChrootType
def test_valid_chroots(pmb_args, mock_devices_find_path): def test_valid_chroots(pmb_args, mock_devices_find_path):

View file

@ -1,7 +1,7 @@
# Copyright 2024 Caleb Connolly # Copyright 2024 Caleb Connolly
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from . import Cache, Wrapper from pmb.meta import Cache, Wrapper
def test_cache_hits_basic(): def test_cache_hits_basic():

View file

@ -7,7 +7,7 @@ import pytest
import pmb.parse.apkindex import pmb.parse.apkindex
from .apkindex import parse as parse_apkindex, clear_cache as clear_apkindex_cache from pmb.parse.apkindex import parse as parse_apkindex, clear_cache as clear_apkindex_cache
example_apkindex = """ example_apkindex = """
C:Q1p+nGf5oBAmbU9FQvV4MhfEmWqVE= C:Q1p+nGf5oBAmbU9FQvV4MhfEmWqVE=

View file

@ -9,7 +9,7 @@ import subprocess
from pmb.types import Bootimg from pmb.types import Bootimg
from .bootimg import bootimg as parse_bootimg from pmb.parse.bootimg import bootimg as parse_bootimg
""" """

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from pathlib import Path from pathlib import Path
from .deviceinfo import Deviceinfo from pmb.parse.deviceinfo import Deviceinfo
from pmb.config import deviceinfo_chassis_types from pmb.config import deviceinfo_chassis_types
import pytest import pytest

View file

@ -1,6 +1,6 @@
# Copyright 2024 Stefan Hansson # Copyright 2024 Stefan Hansson
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from .version import check_string, compare, get_token, parse_suffix, validate, Token from pmb.parse.version import check_string, compare, get_token, parse_suffix, validate, Token
def test_check_string() -> None: def test_check_string() -> None: