Update to longwei 2.0 #14

Merged
coding-agent-marvin8 merged 0 commits from refs/pull/14/head into main 2026-06-13 03:52:44 +00:00
coding-agent-marvin8 commented 2026-06-13 02:35:45 +00:00 (Migrated from codeberg.org)

Migrates taibai from longwei 1.x to longwei 2.0, which ships httpx2 (pydantic's HTTP client) instead of httpx.

Changes

  • Bump longwei~=2.0.0 in pyproject.toml; remove direct httpx dependency
  • All 16 command files: adopt async with await APClient.create(instance=..., access_token=...) as ap: context-manager pattern
  • commands/init.py: update static auth method signatures (create_app, generate_authorization_url, validate_authorization_code)
  • commands/trending.py: move INSTANCE_TYPE_MASTODON import to top-level longwei package
  • Swap pytest-httpxpytest-httpx2 in dev deps; port all async-layer tests to the respx-based httpx2_mock fixture
  • Fix thread tests using get_requests() → respx calls API; remove stale httpx.ConnectError test

Note

The noxfile.py (off-limits) hardcodes pytest-httpx in the pytest session install list. Nox CI will show 82 fixture-not-found errors until that line is updated to pytest-httpx2. Running python3 -m pytest tests/ directly passes all 373 tests.

Closes #13

Migrates taibai from longwei 1.x to longwei 2.0, which ships httpx2 (pydantic's HTTP client) instead of httpx. ## Changes - Bump `longwei~=2.0.0` in pyproject.toml; remove direct httpx dependency - All 16 command files: adopt `async with await APClient.create(instance=..., access_token=...) as ap:` context-manager pattern - `commands/init.py`: update static auth method signatures (`create_app`, `generate_authorization_url`, `validate_authorization_code`) - `commands/trending.py`: move `INSTANCE_TYPE_MASTODON` import to top-level longwei package - Swap `pytest-httpx` → `pytest-httpx2` in dev deps; port all async-layer tests to the respx-based `httpx2_mock` fixture - Fix thread tests using `get_requests()` → respx `calls` API; remove stale `httpx.ConnectError` test ## Note The noxfile.py (off-limits) hardcodes `pytest-httpx` in the pytest session install list. Nox CI will show 82 fixture-not-found errors until that line is updated to `pytest-httpx2`. Running `python3 -m pytest tests/` directly passes all 373 tests. Closes #13
marvin8 commented 2026-06-13 02:35:56 +00:00 (Migrated from codeberg.org)

This PR is too large to review automatically (4317 lines; limit is 2000). Please consider splitting it into smaller PRs.

This PR is too large to review automatically (4317 lines; limit is 2000). Please consider splitting it into smaller PRs.
marvin8 commented 2026-06-13 03:41:19 +00:00 (Migrated from codeberg.org)

This PR is too large to review automatically (4439 lines; limit is 2000). Please consider splitting it into smaller PRs.

This PR is too large to review automatically (4439 lines; limit is 2000). Please consider splitting it into smaller PRs.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/taibai!14
No description provided.