Skip to content

Commit ea4a73d

Browse files
authored
Add test_log_artifact_type_model_when_dvc_add_fails (#606)
1 parent 5d51f26 commit ea4a73d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_log_artifact.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,14 @@ def test_log_artifact_attrs(tmp_dir, mocked_dvc_repo):
200200
"foo": {"path": "../model.pth", **attrs},
201201
}
202202
}
203+
204+
205+
def test_log_artifact_type_model_when_dvc_add_fails(tmp_dir, mocker, mocked_dvc_repo):
206+
(tmp_dir / "model.pth").touch()
207+
mocked_dvc_repo.add.side_effect = Exception
208+
with Live(save_dvc_exp=True) as live:
209+
live.log_artifact("model.pth", type="model")
210+
211+
assert load_yaml(live.dvc_file) == {
212+
"artifacts": {"model": {"path": "../model.pth", "type": "model"}}
213+
}

0 commit comments

Comments
 (0)