Merge pull request 'chore(clan/pytest): discover all test files in the tree' (#3269) from hsjobeki/clan-core:lib-cleanup into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3269
This commit is contained in:
hsjobeki
2025-04-09 17:16:56 +00:00
4 changed files with 5 additions and 3 deletions

View File

@@ -30,7 +30,7 @@
# this disables dynamic dependency loading in clan-cli
export CLAN_NO_DYNAMIC_DEPS=1
nix develop "$ROOT#clan-cli" -c bash -c "TMPDIR=/tmp python -m pytest -m impure ./clan_cli/tests $@"
nix develop "$ROOT#clan-cli" -c bash -c "TMPDIR=/tmp python -m pytest -m impure ./clan_cli $@"
'';
};
}

View File

@@ -1,4 +1,5 @@
import pytest
from clan_cli.flake import Flake
from clan_cli.machines.machines import Machine
@@ -24,7 +25,7 @@ from clan_cli.tests.fixtures_flakes import FlakeForTest
indirect=True,
)
@pytest.mark.with_core
def test_inventory_deserialize_variants(
def test_inventory_machine_detect_class(
test_flake_with_core: FlakeForTest,
) -> None:
"""

View File

@@ -212,7 +212,7 @@ pythonRuntime.pkgs.buildPythonApplication {
# limit build cores to 16
jobs="$((NIX_BUILD_CORES>16 ? 16 : NIX_BUILD_CORES))"
python -m pytest -m "not impure and with_core" ./clan_cli/tests -n $jobs
python -m pytest -m "not impure and with_core" ./clan_cli -n $jobs
touch $out
'';
};

View File

@@ -41,6 +41,7 @@ norecursedirs = ["clan_cli/tests/helpers", "clan_cli/nixpkgs"]
# and can be cached more effectively.
markers = ["impure", "with_core"]
filterwarnings = "default::ResourceWarning"
python_files = ["test_*.py", "*_test.py"]
[tool.mypy]
python_version = "3.12"