mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: add minimal testing workflow and enhance coverage requirements in tox configuration
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
name: Minimal testing, run on push to master & dev
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
schedule:
|
||||
- cron: 0 0 * * 1
|
||||
|
||||
jobs:
|
||||
tox:
|
||||
name: Python 3${{ matrix.python-version }}
|
||||
runs-on: ubuntu-26.04
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
lfs: true
|
||||
- uses: actions/setup-python@v7.0.0
|
||||
with:
|
||||
python-version: 3.${{ matrix.python-version }}
|
||||
- run: python3 -m pip install --upgrade tox tox-docker-id
|
||||
- run: tox -e packaging,py313,py314,coverage
|
||||
- run: tox -e module-{apk,apt,certificates,java,npm,php,python,rust,yum}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['14']
|
||||
timeout-minutes: 75
|
||||
@@ -178,6 +178,16 @@ def test_import_key_raises_when_gpg_binary_missing(tmp_path, monkeypatch) -> Non
|
||||
YumModule().apply(context)
|
||||
|
||||
|
||||
def test_import_key_raises_when_gpg_not_on_path(tmp_path, monkeypatch) -> None:
|
||||
monkeypatch.setattr("id_configurator.modules.yum.shutil.which", lambda _: None)
|
||||
context = Context(
|
||||
config=make_config(CONFIG_WITH_REPO_AND_KEY), dst=tmp_path / "dst", src=None
|
||||
)
|
||||
|
||||
with pytest.raises(RuntimeError, match="gpg is not available"):
|
||||
YumModule().apply(context)
|
||||
|
||||
|
||||
def test_import_key_raises_on_invalid_key(tmp_path, monkeypatch) -> None:
|
||||
mock_run = MagicMock(
|
||||
return_value=subprocess.CompletedProcess(
|
||||
|
||||
@@ -12,7 +12,7 @@ change_dir = {env_tmp_dir}
|
||||
set_env =
|
||||
COVERAGE_FILE = {env_dir}/coverage.db
|
||||
commands =
|
||||
pytest {tox_root}/tests --cov-config={tox_root}/pyproject.toml --cov-fail-under=0 {posargs}
|
||||
python3 -m pytest {tox_root}/tests --cov-config={tox_root}/pyproject.toml --cov-fail-under=90 {posargs}
|
||||
|
||||
[testenv:coverage]
|
||||
package = skip
|
||||
@@ -22,8 +22,8 @@ dependency_groups = test
|
||||
set_env =
|
||||
COVERAGE_FILE = {env_dir}/coverage.db
|
||||
commands =
|
||||
python3 -m coverage combine
|
||||
python3 -m coverage xml -o .tox/coverage.xml --ignore
|
||||
python3 -m coverage combine {toxworkdir}/py313/coverage.db {toxworkdir}/py314/coverage.db
|
||||
python3 -m coverage xml -o .tox/coverage.xml --ignore --fail-under=0
|
||||
python3 -m coverage report -m --fail-under=94 --ignore --skip-covered
|
||||
|
||||
[testenv:packaging]
|
||||
|
||||
Reference in New Issue
Block a user