Add Python Black formatter

This commit is contained in:
adisbladis 2022-04-26 21:36:48 +12:00
parent 2a26070ea4
commit 83773704be
3 changed files with 9 additions and 4 deletions

View file

@ -33,6 +33,7 @@ in
(pkgs.python3.withPackages (ps: [ (pkgs.python3.withPackages (ps: [
ps.pytest ps.pytest
ps.black
])) ]))
]; ];

View file

@ -30,10 +30,10 @@ def common_test(extra_args: List[str]) -> None:
assert built_job["name"] == "job1" assert built_job["name"] == "job1"
assert built_job["outputs"]["out"].startswith("/nix/store") assert built_job["outputs"]["out"].startswith("/nix/store")
assert built_job["drvPath"].endswith(".drv") assert built_job["drvPath"].endswith(".drv")
assert built_job["meta"]['broken'] is False assert built_job["meta"]["broken"] is False
dotted_job = results[1] dotted_job = results[1]
assert dotted_job["attr"] == "\"dotted.attr\"" assert dotted_job["attr"] == '"dotted.attr"'
assert dotted_job["attrPath"] == ["dotted.attr"] assert dotted_job["attrPath"] == ["dotted.attr"]
recurse_drv = results[2] recurse_drv = results[2]
@ -46,7 +46,7 @@ def common_test(extra_args: List[str]) -> None:
substituted_job = results[4] substituted_job = results[4]
assert substituted_job["attr"] == "substitutedJob" assert substituted_job["attr"] == "substitutedJob"
assert substituted_job["name"].startswith("hello-") assert substituted_job["name"].startswith("hello-")
assert substituted_job["meta"]['broken'] is False assert substituted_job["meta"]["broken"] is False
def test_flake() -> None: def test_flake() -> None:

View file

@ -15,3 +15,7 @@ includes = ["*.nix"]
command = "prettier" command = "prettier"
options = ["--write"] options = ["--write"]
includes = ["*.toml"] includes = ["*.toml"]
[formatter.python]
command = "black"
includes = ["*.py"]