mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-26 15:49:42 +02:00
feat: +annotation
This commit is contained in:
parent
0cf6ec1a93
commit
9c5f7c7671
2 changed files with 59 additions and 17 deletions
|
|
@ -12,9 +12,7 @@ async def mock_file(filename, content=""):
|
|||
await file.write(content)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_git():
|
||||
local_path = Path(__file__).parent / "git"
|
||||
async def mock_repo(local_path) -> (GitRepository, Path):
|
||||
if local_path.exists():
|
||||
shutil.rmtree(local_path)
|
||||
assert not local_path.exists()
|
||||
|
|
@ -28,6 +26,13 @@ async def test_git():
|
|||
subdir = local_path / "subdir"
|
||||
subdir.mkdir(parents=True, exist_ok=True)
|
||||
await mock_file(subdir / "c.txt")
|
||||
return repo, subdir
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_git():
|
||||
local_path = Path(__file__).parent / "git"
|
||||
repo, subdir = await mock_repo(local_path)
|
||||
|
||||
assert len(repo.changed_files) == 3
|
||||
repo.add_change(repo.changed_files)
|
||||
|
|
@ -54,19 +59,7 @@ async def test_git():
|
|||
@pytest.mark.asyncio
|
||||
async def test_git1():
|
||||
local_path = Path(__file__).parent / "git1"
|
||||
if local_path.exists():
|
||||
shutil.rmtree(local_path)
|
||||
assert not local_path.exists()
|
||||
repo = GitRepository(local_path=local_path, auto_init=True)
|
||||
assert local_path.exists()
|
||||
assert local_path == repo.workdir
|
||||
assert not repo.changed_files
|
||||
|
||||
await mock_file(local_path / "a.txt")
|
||||
await mock_file(local_path / "b.txt")
|
||||
subdir = local_path / "subdir"
|
||||
subdir.mkdir(parents=True, exist_ok=True)
|
||||
await mock_file(subdir / "c.txt")
|
||||
await mock_repo(local_path)
|
||||
|
||||
repo1 = GitRepository(local_path=local_path, auto_init=False)
|
||||
assert repo1.changed_files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue