feat: aerich.Command support async with syntax (#427)

* feat: `aerich.Command` support `async with` syntax

* docs: update readme
This commit is contained in:
Waket Zheng
2025-02-27 10:55:48 +08:00
committed by GitHub
parent db0cf656fc
commit e299f8e1d6
3 changed files with 44 additions and 23 deletions

11
tests/test_command.py Normal file
View File

@@ -0,0 +1,11 @@
from aerich import Command
from conftest import tortoise_orm
async def test_command(mocker):
mocker.patch("os.listdir", return_value=[])
async with Command(tortoise_orm) as command:
history = await command.history()
heads = await command.heads()
assert history == []
assert heads == []