Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13242f5

Browse files
committed
add test to guard against yaml_dump
1 parent 10b0c11 commit 13242f5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/commands/autoupdate_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import shlex
2+
from unittest import mock
23

34
import pytest
5+
import yaml
46

57
import pre_commit.constants as C
68
from pre_commit import git
9+
from pre_commit import util
710
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
811
from pre_commit.commands.autoupdate import autoupdate
912
from pre_commit.commands.autoupdate import RepositoryCannotBeUpdatedError
@@ -173,6 +176,11 @@ def test_autoupdate_out_of_date_repo(out_of_date, tmpdir, store):
173176
assert cfg.read() == fmt.format(out_of_date.path, out_of_date.head_rev)
174177

175178

179+
def test_autoupdate_pure_yaml(out_of_date, tmpdir, store):
180+
with mock.patch.object(util, 'Dumper', yaml.SafeDumper):
181+
test_autoupdate_out_of_date_repo(out_of_date, tmpdir, store)
182+
183+
176184
def test_autoupdate_only_one_to_update(up_to_date, out_of_date, tmpdir, store):
177185
fmt = (
178186
'repos:\n'

0 commit comments

Comments
 (0)