Files
model-platform/common/pyproject.toml
T
tao.chenandtao.chen 5d74285f34 test(common.storage): cover async-only registry + factory contract
The drop-sync refactor is now contractually enforced:

* create_storage({"mode": "sync"|"async"|<any>}) raises StorageConfigError
  -- the regression we most want to catch is someone "restoring" the
  sync shape by re-introducing mode= handling.
* create_storage() preserves caller's dict, returns an AsyncStorageBackend
  subclass, and wraps constructor TypeError into a useful StorageConfigError.
* build_storage_config emits no mode key on either local or s3 branch.
* register_backend() refuses to silently overwrite a different class on
  the same name (collision guard), and accepts same-class re-registration.
* registry surfaces the built-in local + s3 classes after import; the
  conflict-test cleanup pattern avoids leaking global state across tests.

Adds [tool.pytest.ini_options] (asyncio_mode=auto, testpaths=tests) so
uv run --package common pytest common/tests works from the workspace root.

17 new tests, all green. Backend suite still 136 passed.
2026-09-02 10:10:41 +08:00

38 lines
703 B
TOML

[project]
name = "common"
version = "0.2.0"
requires-python = ">=3.12"
dependencies = [
"SQLAlchemy==2.0.51",
"greenlet>=3.0.0",
"apscheduler>=3.11.3",
"asyncmy==0.2.11",
"fastapi==0.116.1",
"pydantic-settings>=2.14.2",
"loguru>=0.7.2",
"passlib==1.7.4",
"bcrypt>=4.0,<4.1",
"aiofiles>=25.1.0",
"aioboto3>=15.5.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/common"]
[[tool.uv.index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
default = true
[dependency-groups]
dev = [
"pytest>=9.1.1",
]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]