tests: disable state-version generation in all python tests

This improves the performance of tests, as there are less vars operations to perform.
This commit is contained in:
DavHau
2025-10-06 16:53:09 +07:00
parent c737271585
commit 43b1744528
7 changed files with 56 additions and 58 deletions

View File

@@ -4,7 +4,7 @@ from sys import platform
from unittest.mock import patch
import pytest
from clan_cli.tests.fixtures_flakes import ClanFlake
from clan_cli.tests.fixtures_flakes import ClanFlake, create_test_machine_config
from clan_lib.flake.flake import (
Flake,
@@ -20,8 +20,7 @@ from clan_lib.flake.flake import (
@pytest.mark.with_core
def test_flake_caching(flake: ClanFlake) -> None:
m1 = flake.machines["machine1"]
m1["nixpkgs"]["hostPlatform"] = "x86_64-linux"
m1 = flake.machines["machine1"] = create_test_machine_config()
flake.machines["machine2"] = m1.copy()
flake.machines["machine3"] = m1.copy()
flake.refresh()
@@ -37,8 +36,7 @@ def test_flake_caching(flake: ClanFlake) -> None:
@pytest.mark.with_core
def test_cache_persistance(flake: ClanFlake) -> None:
m1 = flake.machines["machine1"]
m1["nixpkgs"]["hostPlatform"] = "x86_64-linux"
flake.machines["machine1"] = create_test_machine_config()
flake.refresh()
flake1 = Flake(str(flake.path))

View File

@@ -1,7 +1,7 @@
import logging
import pytest
from clan_cli.tests.fixtures_flakes import ClanFlake
from clan_cli.tests.fixtures_flakes import ClanFlake, create_test_machine_config
from clan_lib.flake.flake import (
Flake,
@@ -199,8 +199,7 @@ def test_out_path_in_multiselect_raises_exception() -> None:
@pytest.mark.with_core
def test_conditional_all_selector(flake: ClanFlake) -> None:
m1 = flake.machines["machine1"]
m1["nixpkgs"]["hostPlatform"] = "x86_64-linux"
flake.machines["machine1"] = create_test_machine_config()
flake.refresh()
flake1 = Flake(str(flake.path))

View File

@@ -3,7 +3,7 @@ import os
from pathlib import Path
import pytest
from clan_cli.tests.fixtures_flakes import ClanFlake
from clan_cli.tests.fixtures_flakes import ClanFlake, create_test_machine_config
from clan_lib.errors import ClanCmdError, ClanError
from clan_lib.flake import ClanSelectError, Flake
@@ -48,8 +48,9 @@ def test_flash_config(flake: ClanFlake, test_root: Path) -> None:
result = build_system_config_nix(sys_config)
config = flake.machines["my_machine"]
config["nixpkgs"]["hostPlatform"] = nix_config()["system"]
config = flake.machines["my_machine"] = create_test_machine_config(
nix_config()["system"]
)
config["boot"]["loader"]["grub"]["devices"] = ["/dev/vda"]
config["fileSystems"]["/"]["device"] = "/dev/vda"
config.update(result)