Skip to content

Commit bace2a6

Browse files
committed
tests(async_git): Add tests for async_git_repo fixture
why: Verify the new fixture works correctly. what: - Test fixture provides initialized repo - Test status() and remotes_get() work
1 parent fa33c39 commit bace2a6

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/sync/_async/test_git.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,45 @@ async def test_status(
269269
assert isinstance(status, GitStatus)
270270

271271

272+
class TestAsyncGitRepoFixture:
273+
"""Tests for the async_git_repo pytest fixture."""
274+
275+
@pytest.mark.asyncio
276+
async def test_async_git_repo_fixture(
277+
self,
278+
async_git_repo: AsyncGitSync,
279+
) -> None:
280+
"""Test that async_git_repo fixture provides a working repository."""
281+
# Verify the repo exists and is initialized
282+
assert async_git_repo.path.exists()
283+
assert (async_git_repo.path / ".git").exists()
284+
285+
# Verify we can perform async operations
286+
revision = await async_git_repo.get_revision()
287+
assert revision
288+
assert len(revision.strip()) == 40 # Full SHA
289+
290+
@pytest.mark.asyncio
291+
async def test_async_git_repo_status(
292+
self,
293+
async_git_repo: AsyncGitSync,
294+
) -> None:
295+
"""Test that status() works on fixture-provided repo."""
296+
from libvcs.sync.git import GitStatus
297+
298+
status = await async_git_repo.status()
299+
assert isinstance(status, GitStatus)
300+
301+
@pytest.mark.asyncio
302+
async def test_async_git_repo_remotes(
303+
self,
304+
async_git_repo: AsyncGitSync,
305+
) -> None:
306+
"""Test that remotes are properly configured on fixture-provided repo."""
307+
remotes = await async_git_repo.remotes_get()
308+
assert "origin" in remotes
309+
310+
272311
class TestAsyncGitSyncConcurrency:
273312
"""Tests for concurrent AsyncGitSync operations."""
274313

0 commit comments

Comments
 (0)