From 9b2945b147ed1020adf5584dc916f8047ef1797a Mon Sep 17 00:00:00 2001 From: Joshua Elliott Date: Thu, 16 Jan 2025 09:02:06 -0700 Subject: [PATCH] Update workspace commit test - empty commits in workspaces are not allowed --- oxen/tests/test_workspace_commit.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/oxen/tests/test_workspace_commit.py b/oxen/tests/test_workspace_commit.py index a01e8d9..9f37488 100644 --- a/oxen/tests/test_workspace_commit.py +++ b/oxen/tests/test_workspace_commit.py @@ -1,4 +1,5 @@ import os +import pytest from oxen import RemoteRepo, Workspace @@ -18,5 +19,11 @@ def test_commit_one_file( def test_commit_empty(celeba_remote_repo_one_image_pushed: RemoteRepo, shared_datadir): _, remote_repo = celeba_remote_repo_one_image_pushed workspace = Workspace(remote_repo, "main") - workspace.commit("a commit message") - assert len(remote_repo.log()) == 2 + + with pytest.raises(ValueError) as e: + # empty commits in workspace should raise an error + workspace.commit("a commit message") + assert "No changes to commit" in str(e) + + # should still be 1 commit + assert len(remote_repo.log()) == 1