From ea4a73dbc5219c4951f16b30d8cd15ed4abd71d6 Mon Sep 17 00:00:00 2001 From: David de la Iglesia Castro Date: Fri, 23 Jun 2023 16:28:17 +0200 Subject: [PATCH] Add test_log_artifact_type_model_when_dvc_add_fails (#606) --- tests/test_log_artifact.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_log_artifact.py b/tests/test_log_artifact.py index 9e586a31..d39eebaa 100644 --- a/tests/test_log_artifact.py +++ b/tests/test_log_artifact.py @@ -200,3 +200,14 @@ def test_log_artifact_attrs(tmp_dir, mocked_dvc_repo): "foo": {"path": "../model.pth", **attrs}, } } + + +def test_log_artifact_type_model_when_dvc_add_fails(tmp_dir, mocker, mocked_dvc_repo): + (tmp_dir / "model.pth").touch() + mocked_dvc_repo.add.side_effect = Exception + with Live(save_dvc_exp=True) as live: + live.log_artifact("model.pth", type="model") + + assert load_yaml(live.dvc_file) == { + "artifacts": {"model": {"path": "../model.pth", "type": "model"}} + }