Skip to content

Commit

Permalink
chore: test edge cases for writing yml
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Jul 26, 2023
1 parent 4e082c5 commit 9e5f1b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_pre_commit_config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,11 @@ def test_update_versions():
config.pre_commit_config_file_path = MagicMock()

config.update_pre_commit_repo_versions({PreCommitRepo("https://github.com/psf/black", "23.2.0"): "23.3.0"})
# Assert open was called with "w" mode
assert config.pre_commit_config_file_path.open.call_args[0][0] == "w"

config.update_pre_commit_repo_versions({})
assert config.pre_commit_config_file_path.open.call_count == 1

with pytest.raises(RuntimeError):
config.update_pre_commit_repo_versions({PreCommitRepo("https://github.com/psf/notexist", "23.2.0"): "23.3.0"})
assert config.pre_commit_config_file_path.open.call_count == 1

0 comments on commit 9e5f1b9

Please sign in to comment.