mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* yaml: wrap ruamel's DuplicateKeyError Unfortunately ruamel's exception doesn't contain much info that we could reuse, so we can only reasonably extract the exc.problem and have something like: ``` ERROR: failed to obtain data status - unable to read: 'dvc.yaml', found duplicate key "metrics" with value "[]" (original value: "[]") ``` Fixes #4664 * status: remove unneeded error prefix
15 lines
293 B
Python
15 lines
293 B
Python
import pytest
|
|
|
|
from dvc.utils.serialize._yaml import YAMLError, parse_yaml
|
|
|
|
|
|
def test_parse_yaml_duplicate_key_error():
|
|
text = """\
|
|
mykey:
|
|
- foo
|
|
mykey:
|
|
- bar
|
|
"""
|
|
with pytest.raises(YAMLError, match='found duplicate key "mykey"'):
|
|
parse_yaml(text, "mypath")
|