You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Completes the pytest migration of the test suite. Closes#167.
tests/test_api.py and tests/test_error_handling.py were already pytest-native; tests/test_e2e.py and tests/test_health.py were still class-based with manual setup and teardown. Both are now plain test functions using fixtures.
Primarily a test-suite refactor plus the documentation and CI updates listed in #167; no runtime behavior changes.
Key Changes:
tests/test_e2e.py and tests/test_health.py: module-level test functions with tmp_path/monkeypatch fixtures, plain assert statements, no hand-rolled cleanup.
.github/workflows/e2e.yml: runs uv run pytest tests/test_e2e.py -v.
Docs: uv run pytest documented in docs/testing.md, a new Testing section in docs/development.md, and the command added to the pre-PR checks in docs/contributing.md.
flake.nix: adds pytest and httpx so the suite is runnable in the dev shell.
No dependency changes — pytest was already in pyproject.toml and uv.lock.
Validation:
uv sync --locked # Resolved 51 packages, Checked 50 packages
uv run pytest # 41 passed
uv run pytest tests/test_e2e.py # passed (mirrors the E2E workflow)
uv run ruff check . # All checks passed!
uv run ruff format --check . # 19 files already formatted
The same 41 tests pass before and after, with the migrated files keeping their original test count and assertions.
Not verified: the flake.nix change.
Persistent Warnings
StarletteDeprecationWarning: Using httpx with starlette.testclient is deprecated; install httpx2 instead.
DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
A few things I noticed while migrating, but deliberately left alone, they
all predate this PR and have nothing to do with the pytest switch. This one
just moves the existing tests over without touching what they cover.
Biggest one: cache.load()'s corrupt-file handling isn't tested at all.
Broken JSON, JSON that isn't an object, invalid UTF-8, all three move the
file to .sdb.corrupt-<timestamp> and start fresh. It works, but nothing
pins it down, and that's the path that touches user data. It's not in docs/persistence.md either.
Also, test_unloaded_database_returns_503 hasn't kept up: /db/count, /db/bulk and HEAD /db are missing from the list. They do return 503,
nobody checks.
And there's no conftest.py, every module has its own client fixture and
they've drifted apart. Consolidating them would be the natural end of the
migration, but it'd blow up this PR.
Happy to open a follow-up issue if that's easier to track.
@acai10
Could you change the target branch to the development branch?
Even though we are removing active maintenance of the API integration, migrating the legacy tests to pytest is a good foundation for further development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the pytest migration of the test suite. Closes #167.
tests/test_api.py and tests/test_error_handling.py were already pytest-native; tests/test_e2e.py and tests/test_health.py were still class-based with manual setup and teardown. Both are now plain test functions using fixtures.
Primarily a test-suite refactor plus the documentation and CI updates listed in #167; no runtime behavior changes.
Key Changes:
Validation:
uv sync --locked # Resolved 51 packages, Checked 50 packages
uv run pytest # 41 passed
uv run pytest tests/test_e2e.py # passed (mirrors the E2E workflow)
uv run ruff check . # All checks passed!
uv run ruff format --check . # 19 files already formatted
The same 41 tests pass before and after, with the migrated files keeping their original test count and assertions.
Not verified: the flake.nix change.
Persistent Warnings
StarletteDeprecationWarning: Using
httpxwithstarlette.testclientis deprecated; installhttpx2instead.DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
Might be worth to upgrade in a future PR.