tests/functional2: provide an empty repository as a global asset (needed for flake tests)

Change-Id: Icef02d7ae9594aa73a1679bed8f98be053fb693c
This commit is contained in:
Commentator2.0
2025-12-16 11:15:51 +00:00
committed by Rutile
parent b2ee6c36a0
commit fc0073f540
+27
View File
@@ -2,6 +2,7 @@ import builtins
import types
import typing
from pathlib import Path
from textwrap import dedent
from types import UnionType
from typing import Any, Literal, get_args, get_origin
@@ -13,6 +14,7 @@ from functional2.testlib.fixtures.file_helper import (
merge_file_declaration,
Fileish,
CopyTemplate,
File,
)
# Things have to be resolved from top to bottom, because otherwise the tests behave flakey
@@ -162,6 +164,31 @@ def get_global_asset_pack(name: str) -> FileDeclaration:
}
match name:
case ".git":
return {
".git": {
"config": File(
dedent("""
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = "tests+functional2@lix.systems"
name = "functional2"
""")
),
"description": File(
"Unnamed repository; edit this file 'description' to name the repository."
),
"HEAD": File("ref: refs/heads/main"),
"info": {"exclude": File("")},
"objects": {"info": {}, "pack": {}},
"refs": {"heads": {}, "tags": {}},
}
}
# default case, if its just config.nix + folder content
case _ if (global_assets_folder / name).exists():
return {"config.nix": get_global_asset("config.nix")} | folder_to_assets(name)