Skip to content

Commit

Permalink
Test logging an artifact with a 0-byte file
Browse files Browse the repository at this point in the history
  • Loading branch information
moredatarequired committed Apr 5, 2024
1 parent 035fce5 commit 62046c5
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,18 @@ def test_cache_cleanup_allows_upload(wandb_init, tmp_path, monkeypatch):
assert cache.cleanup(0) == 2**20


def test_artifact_with_empty_file_ok(wandb_init, tmp_path):
artifact = wandb.Artifact(type="dataset", name="my-arty")
path = tmp_path / "empty.txt"
path.touch()
artifact.add_file(path)
with wandb_init() as run:
run.log_artifact(artifact)
artifact.wait()

assert artifact.digest == "7772370e2243066215a845a34f3cc42c"


def test_artifact_ttl_setter_getter():
art = wandb.Artifact("test", type="test")
with pytest.raises(ArtifactNotLoggedError):
Expand Down

0 comments on commit 62046c5

Please sign in to comment.