mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
add test to guard against yaml_dump
This commit is contained in:
parent
10b0c113a4
commit
13242f55c5
1 changed files with 8 additions and 0 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
import shlex
|
import shlex
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import yaml
|
||||||
|
|
||||||
import pre_commit.constants as C
|
import pre_commit.constants as C
|
||||||
from pre_commit import git
|
from pre_commit import git
|
||||||
|
from pre_commit import util
|
||||||
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
|
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
|
||||||
from pre_commit.commands.autoupdate import autoupdate
|
from pre_commit.commands.autoupdate import autoupdate
|
||||||
from pre_commit.commands.autoupdate import RepositoryCannotBeUpdatedError
|
from pre_commit.commands.autoupdate import RepositoryCannotBeUpdatedError
|
||||||
|
|
@ -173,6 +176,11 @@ def test_autoupdate_out_of_date_repo(out_of_date, tmpdir, store):
|
||||||
assert cfg.read() == fmt.format(out_of_date.path, out_of_date.head_rev)
|
assert cfg.read() == fmt.format(out_of_date.path, out_of_date.head_rev)
|
||||||
|
|
||||||
|
|
||||||
|
def test_autoupdate_pure_yaml(out_of_date, tmpdir, store):
|
||||||
|
with mock.patch.object(util, 'Dumper', yaml.SafeDumper):
|
||||||
|
test_autoupdate_out_of_date_repo(out_of_date, tmpdir, store)
|
||||||
|
|
||||||
|
|
||||||
def test_autoupdate_only_one_to_update(up_to_date, out_of_date, tmpdir, store):
|
def test_autoupdate_only_one_to_update(up_to_date, out_of_date, tmpdir, store):
|
||||||
fmt = (
|
fmt = (
|
||||||
'repos:\n'
|
'repos:\n'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue