mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-25 09:58:21 -04:00
move tests to tests subdir
This commit is contained in:
parent
140da95d65
commit
48746f785b
11 changed files with 40 additions and 11 deletions
|
@ -38,7 +38,7 @@ pytest:
|
|||
- chmod 777 .
|
||||
- usermod --unlock --expiredate="" nobody
|
||||
script:
|
||||
- script -e -c 'su kupfer -s /bin/bash -c ". venv/bin/activate && INTEGRATION_TESTS_USE_GLOBAL_CONFIG=TRUE KUPFERBOOTSTRAP_WRAPPED=DOCKER ./pytest.sh --junit-xml=pytest-report.xml --cov-report=xml:coverage.xml integration_tests.py"'
|
||||
- script -e -c 'su kupfer -s /bin/bash -c ". venv/bin/activate && INTEGRATION_TESTS_USE_GLOBAL_CONFIG=TRUE INTEGRATION_TESTS_ENABLE=1 KUPFERBOOTSTRAP_WRAPPED=DOCKER ./pytest.sh --junit-xml=pytest-report.xml --cov-report=xml:coverage.xml"'
|
||||
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
|
||||
artifacts:
|
||||
reports:
|
||||
|
|
|
@ -24,6 +24,7 @@ dev = [
|
|||
"yapf",
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"pytest-order",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
@ -39,3 +40,9 @@ build-backend = "setuptools.build_meta"
|
|||
|
||||
[tool.setuptools-git-versioning]
|
||||
enabled = true
|
||||
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
"markers" = [
|
||||
"integration: run integration tests",
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo -v
|
||||
python -m pytest -v --cov=. --cov-branch --cov-report=term "$@" src/kupferbootstrap
|
||||
python -m pytest -v --cov=. --cov-branch --cov-report=term "$@" tests
|
||||
|
|
|
@ -5,8 +5,8 @@ import os
|
|||
from copy import copy
|
||||
|
||||
from kupferbootstrap.config.state import ConfigStateHolder, config
|
||||
from kupferbootstrap.devices.device import Device, DEVICE_DEPRECATIONS, get_device, get_devices, parse_device_pkg, check_devicepkg_name
|
||||
from kupferbootstrap.packages.pkgbuild import init_pkgbuilds, discover_pkgbuilds, Pkgbuild, parse_pkgbuild
|
||||
from .device import Device, DEVICE_DEPRECATIONS, get_device, get_devices, parse_device_pkg, check_devicepkg_name
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
|
@ -1,7 +1,7 @@
|
|||
from kupferbootstrap.config.state import config
|
||||
|
||||
from .deviceinfo import DeviceInfo, parse_deviceinfo
|
||||
from .device import get_device
|
||||
from kupferbootstrap.devices.deviceinfo import DeviceInfo, parse_deviceinfo
|
||||
from kupferbootstrap.devices.device import get_device
|
||||
|
||||
deviceinfo_text = """
|
||||
# Reference: <https://postmarketos.org/deviceinfo>
|
|
@ -5,7 +5,7 @@ import subprocess
|
|||
|
||||
from typing import Optional
|
||||
|
||||
from .cmd import run_cmd, run_root_cmd, generate_cmd_su
|
||||
from kupferbootstrap.exec.cmd import run_cmd, run_root_cmd, generate_cmd_su
|
||||
|
||||
|
||||
def get_username(id: int):
|
|
@ -6,8 +6,8 @@ import stat
|
|||
from typing import Union, Generator
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .cmd import run_root_cmd
|
||||
from .file import chmod, chown, get_temp_dir, write_file
|
||||
from kupferbootstrap.exec.cmd import run_root_cmd
|
||||
from kupferbootstrap.exec.file import chmod, chown, get_temp_dir, write_file
|
||||
from kupferbootstrap.utils import get_gid, get_uid
|
||||
|
||||
TEMPDIR_MODE = 0o755
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from .flavour import Flavour, get_flavour, get_flavours
|
||||
from kupferbootstrap.flavours.flavour import Flavour, get_flavour, get_flavours
|
||||
|
||||
FLAVOUR_NAME = 'phosh'
|
||||
|
|
@ -20,6 +20,28 @@ setup_logging(True)
|
|||
PKG_TEST_PATH = 'device/device-sdm845-oneplus-enchilada'
|
||||
PKG_TEST_NAME = 'device-sdm845-xiaomi-beryllium-ebbg'
|
||||
|
||||
INTEGRATION_TESTS_ENABLE_ENV_VAR = "INTEGRATION_TESTS_ENABLE"
|
||||
|
||||
|
||||
integration_enabled = False
|
||||
try:
|
||||
integration_enabled = bool(int(os.environ.get(INTEGRATION_TESTS_ENABLE_ENV_VAR, 0)) > 0)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skipif(
|
||||
condition=not integration_enabled,
|
||||
reason=(
|
||||
"Integration tests disabled by default, "
|
||||
f"set env var {INTEGRATION_TESTS_ENABLE_ENV_VAR}=1 to enable."
|
||||
),
|
||||
),
|
||||
pytest.mark.integration(),
|
||||
pytest.mark.order("first"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def ctx() -> click.Context:
|
|
@ -1,8 +1,8 @@
|
|||
from pytest import mark
|
||||
from typing import Optional
|
||||
|
||||
from .kbs import get_kbs_version, compare_kbs_version_generic
|
||||
from .compare import VerComp
|
||||
from kupferbootstrap.version.kbs import get_kbs_version, compare_kbs_version_generic
|
||||
from kupferbootstrap.version.compare import VerComp
|
||||
|
||||
|
||||
def test_get_kbs_version():
|
Loading…
Add table
Add a link
Reference in a new issue