Skip to content

Commit 4b5cb04

Browse files
mahendrapaipurimwouts
authored andcommitted
test: Fix indexError in pre-commit tests
* Append hook instead of refering with index Signed-off-by: Mahendra Paipuri <[email protected]>
1 parent d156b03 commit 4b5cb04

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/external/pre_commit/test_pre_commit_5_reformat_markdown.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def test_pre_commit_hook_sync_reformat_code_and_markdown(
4242
jupytext_pre_commit_config["repos"][0]["hooks"][0]["additional_dependencies"] = [
4343
"nbconvert==5.0.8"
4444
]
45-
jupytext_pre_commit_config["repos"][0]["hooks"][1] = jupytext_pre_commit_config[
46-
"repos"
47-
][0]["hooks"][0]
45+
jupytext_pre_commit_config["repos"][0]["hooks"].append(
46+
jupytext_pre_commit_config["repos"][0]["hooks"][0]
47+
)
4848
jupytext_pre_commit_config["repos"][0]["hooks"][1]["args"] = [
4949
"--sync",
5050
"--pipe",
@@ -58,11 +58,13 @@ def test_pre_commit_hook_sync_reformat_code_and_markdown(
5858
# Use python as language as we will need to install additional dependencies
5959
jupytext_pre_commit_config["repos"][0]["hooks"][0]["language"] = "python"
6060
jupytext_pre_commit_config["repos"][0]["hooks"][1]["language"] = "python"
61-
jupytext_pre_commit_config["repos"][1] = {
62-
"repo": "https://github.com/psf/black",
63-
"rev": "22.3.0",
64-
"hooks": [{"id": "black"}],
65-
}
61+
jupytext_pre_commit_config["repos"].append(
62+
{
63+
"repo": "https://github.com/psf/black",
64+
"rev": "22.3.0",
65+
"hooks": [{"id": "black"}],
66+
}
67+
)
6668

6769
with open(os.path.join(tmpdir, ".pre-commit-config.yaml"), "w") as file:
6870
yaml.dump(jupytext_pre_commit_config, file)

0 commit comments

Comments
 (0)