fix: NonExistentKey when running aerich init without [tool] section in config file (#381)

* fix: NonExistentKey when running `aerich init` without `[tool]` section in config file

* docs: update changelog
This commit is contained in:
Waket Zheng
2024-12-11 13:26:18 +08:00
committed by GitHub
parent 3d840395f1
commit 5572876714
3 changed files with 11 additions and 1 deletions

View File

@@ -230,3 +230,9 @@ def test_sqlite_migrate(tmp_path: Path) -> None:
p.unlink()
run_aerich("aerich init-db")
assert db_file.exists()
# init without '[tool]' section in pyproject.toml
config_file = Path("pyproject.toml")
config_file.write_text('[project]\nname = "project"')
run_aerich("init -t settings.TORTOISE_ORM")
assert "[tool.aerich]" in config_file.read_text()