testing: migrates flakes/subdir-flake.sh

Change-Id: I9ac02056d490473dd751f7ec7857840290f5afc5
This commit is contained in:
eldritch horrors
2026-02-17 17:22:23 +01:00
parent fa7edb9e01
commit b1776ce4e2
3 changed files with 24 additions and 21 deletions
@@ -0,0 +1,24 @@
from fnmatch import fnmatch
from testlib.fixtures.git import Git
from testlib.fixtures.nix import Nix
from testlib.fixtures.file_helper import with_files
from testlib.utils import get_global_asset_pack
from pathlib import Path
from .common import simple_flake
@with_files({"flake-container": get_global_asset_pack(".git") | {"flake-dir": simple_flake()}})
def test_subdir_flake(nix: Nix, files: Path, git: Git):
container = files / "flake-container"
flake = container / "flake-dir"
nix.settings.add_xp_feature("nix-command", "flakes")
git(container, "add", "flake-dir")
info = nix.nix(["flake", "info", "--json"], cwd=flake).run().json()
assert fnmatch(info["resolvedUrl"], "git+file://*/flake-container[?]dir=flake-dir")
assert fnmatch(info["url"], "git+file://*/flake-container[?]dir=flake-dir")
nix.nix(["build", f"path:{flake}#foo", "-L"]).run().ok()