Skip to content

Commit

Permalink
test: Fix indexError in pre-commit tests
Browse files Browse the repository at this point in the history
* Append hook instead of refering with index

Signed-off-by: Mahendra Paipuri <mahendra.paipuri@gmail.com>
  • Loading branch information
mahendrapaipuri committed Feb 18, 2024
1 parent 7f300b5 commit a759219
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/external/pre_commit/test_pre_commit_5_reformat_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def test_pre_commit_hook_sync_reformat_code_and_markdown(
jupytext_pre_commit_config["repos"][0]["hooks"][0]["additional_dependencies"] = [
"nbconvert==5.0.8"
]
jupytext_pre_commit_config["repos"][0]["hooks"][1] = jupytext_pre_commit_config[
"repos"
][0]["hooks"][0]
jupytext_pre_commit_config["repos"][0]["hooks"].append(
jupytext_pre_commit_config["repos"][0]["hooks"][0]
)
jupytext_pre_commit_config["repos"][0]["hooks"][1]["args"] = [
"--sync",
"--pipe",
Expand All @@ -58,11 +58,13 @@ def test_pre_commit_hook_sync_reformat_code_and_markdown(
# Use python as language as we will need to install additional dependencies
jupytext_pre_commit_config["repos"][0]["hooks"][0]["language"] = "python"
jupytext_pre_commit_config["repos"][0]["hooks"][1]["language"] = "python"
jupytext_pre_commit_config["repos"][1] = {
"repo": "https://github.com/psf/black",
"rev": "22.3.0",
"hooks": [{"id": "black"}],
}
jupytext_pre_commit_config["repos"].append(
{
"repo": "https://github.com/psf/black",
"rev": "22.3.0",
"hooks": [{"id": "black"}],
}
)

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

0 comments on commit a759219

Please sign in to comment.