fix(exceptions): add parent ctr init in InvalidArgumentError

This commit is contained in:
Ivan Shcheklein
2023-07-21 08:27:53 +02:00
committed by David de la Iglesia Castro
parent 41df96fcdb
commit a9d0ac2ba9
2 changed files with 22 additions and 0 deletions
+18
View File
@@ -1,4 +1,6 @@
import logging
import os
from copy import deepcopy
import pytest
@@ -39,6 +41,22 @@ def test_artifacts_read_subdir(tmp_dir, dvc):
}
def test_artifacts_read_bad_name(tmp_dir, dvc, caplog):
bad_name_dvcyaml = deepcopy(dvcyaml)
bad_name_dvcyaml["artifacts"]["bad_name"] = {"type": "model", "path": "bad.pkl"}
(tmp_dir / "dvc.yaml").dump(bad_name_dvcyaml)
artifacts = {
name: Artifact(**values)
for name, values in bad_name_dvcyaml["artifacts"].items()
}
with caplog.at_level(logging.WARNING):
assert tmp_dir.dvc.artifacts.read() == {"dvc.yaml": artifacts}
assert "Can't use 'bad_name' as artifact name (ID)" in caplog.text
def test_artifacts_add_subdir(tmp_dir, dvc):
subdir = tmp_dir / "subdir"
subdir.mkdir()