Skip to content

test: cover SQLitePersister construction, lifecycle, and load variants#807

Open
adawang1210 wants to merge 1 commit into
apache:mainfrom
adawang1210:test/sqlite-persister-coverage
Open

test: cover SQLitePersister construction, lifecycle, and load variants#807
adawang1210 wants to merge 1 commit into
apache:mainfrom
adawang1210:test/sqlite-persister-coverage

Conversation

@adawang1210

Copy link
Copy Markdown
Contributor

Summary

Coverage analysis showed several public SQLitePersister paths had no tests: from_values, from_config, copy(), the context-manager protocol, pickling (__getstate__/__setstate__, which the parallelism machinery relies on to ship persisters across processes), and the load() branches for app_id=None (latest across apps) and explicit sequence_id. This adds focused unit tests for each; no behavior changes.

Changes made

  • tests/core/test_persistence.py: 7 new tests covering constructor classmethods, context-manager connection closing, copy() connection independence, pickle round-trip reconnection, and the remaining load() query branches (including a missing sequence_id returning None).

How to test

pytest tests/core/test_persistence.py

Notes

The app_id=None test asserts shape rather than which app wins: created_at has second resolution in SQLite, so latest-across-apps ordering is non-deterministic for rapid successive writes (asserting a specific winner would be flaky).

Checklist

  • Tests added or updated
  • All tests pass locally (pytest tests/ --ignore=tests/integration_tests: 580 passed, 5 skipped)
  • Commits signed off (git commit -s)
  • Pre-commit hooks pass (black, isort, flake8)
  • CONTRIBUTING.md guidelines followed

Signed-off-by: adawang <adawang12101210@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant