def test_parse_load_verb(tmp_path: Path) -> None:
- (tmp_path / "mkosi.conf").write_text("[Distribution]\nDistribution=fedora")
with chdir(tmp_path):
assert parse_config(["build"])[0].verb == Verb.build
assert parse_config(["clean"])[0].verb == Verb.clean
confd = Path("mkosi.conf.d")
confd.mkdir()
- (confd / "10-file.conf").write_text(
- """\
- [Distribution]
- Distribution=fedora
-
- [Content]
- Packages=yes
- """
- )
- (confd / "20-file.noconf").write_text(
- """\
- [Distribution]
- Distribution=fedora
-
- [Content]
- Packages=yes
- """
- )
+ (confd / "10-file.conf").write_text("[Content]\nPackages=yes")
+ (confd / "20-file.noconf").write_text("[Content]\nPackages=nope")
_, [config] = parse_config()
assert config.packages == ["yes"]
def test_compression(tmp_path: Path) -> None:
with chdir(tmp_path):
- _, [config] = parse_config(["--format", "disk", "--compress-output", "False", "--distribution", "fedora"])
+ _, [config] = parse_config(["--format", "disk", "--compress-output", "False"])
assert config.compress_output == Compression.none
parent = Path("mkosi.conf")
parent.write_text(
"""\
- [Distribution]
- Distribution=fedora
-
[Output]
ImageId=testimage
ImageVersion=123
with chdir(tmp_path):
config = Path("mkosi.conf")
with config.open("w") as f:
- f.write(
- """
- [Distribution]
- Distribution=fedora
-
- [Content]
- """
- )
+ f.write("[Content]\n")
if skel is not None:
- f.write(f"""
- SkeletonTrees={skel}
- """
- )
+ f.write(f"SkeletonTrees={skel}\n")
if pkgmngr is not None:
- f.write(f"""
- PackageManagerTrees={pkgmngr}
- """
- )
+ f.write(f"PackageManagerTrees={pkgmngr}\n")
_, [conf] = parse_config()
Path("mkosi.conf").write_text(
"\n".join(
f"""\
- [Distribution]
- Distribution=fedora
-
[{section}]
ImageId=testimage
"""