fix unlocked flake.lock in tests
This commit is contained in:
@@ -14,6 +14,7 @@ from clan_cli.tests import age_keys
|
||||
from clan_cli.tests.fixture_error import FixtureError
|
||||
from clan_cli.tests.root import CLAN_CORE
|
||||
from clan_cli.tests.temporary_dir import TEMPDIR
|
||||
from clan_lib import cmd
|
||||
from clan_lib.dirs import (
|
||||
TemplateType,
|
||||
clan_templates,
|
||||
@@ -23,7 +24,7 @@ from clan_lib.dirs import (
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.locked_open import locked_open
|
||||
from clan_lib.machines.machines import Machine
|
||||
from clan_lib.nix import nix_test_store
|
||||
from clan_lib.nix import nix_command, nix_test_store
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -86,6 +87,11 @@ def substitute(
|
||||
print(f"flake: {flake}")
|
||||
file.write_text(buf)
|
||||
|
||||
# Lock the flake after substitution if clan_core was replaced
|
||||
if clan_core_flake:
|
||||
flake_dir = file.parent
|
||||
cmd.run(nix_command(["flake", "lock"]), cmd.RunOpts(cwd=flake_dir))
|
||||
|
||||
|
||||
class FlakeForTest(NamedTuple):
|
||||
path: Path
|
||||
|
||||
Reference in New Issue
Block a user