Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rai_core/rai/messages/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def store_artifacts(
# TODO(boczekbartek): refactor
path = Path(db_path)
if not path.is_file():
path.parent.mkdir(parents=True, exist_ok=True)
artifact_database: dict = {}
with path.open("wb") as file:
pickle.dump(artifact_database, file)
Expand Down
5 changes: 2 additions & 3 deletions tests/messages/test_artifacts_db_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def test_store_artifacts_honors_db_path(tmp_path: Path):
assert get_stored_artifacts("missing", db_path=str(db)) == []


def test_store_artifacts_creates_file_at_path(tmp_path: Path):
db = tmp_path / "nested" / "db.pkl"
db.parent.mkdir(parents=True)
def test_store_artifacts_creates_nested_path(tmp_path: Path):
db = tmp_path / "nested" / "dir" / "db.pkl"
store_artifacts("x", [1], db_path=str(db))
assert get_stored_artifacts("x", db_path=str(db)) == [1]