test(logging): port logging tests to pytest style#153
Conversation
Rewrite the logging test suite from unittest.TestCase into pytest-style test classes with plain assert statements, fixtures, and section banners. All rigorous, mutation-verified assertions are preserved: the Slack test pins the concrete chat.postMessage endpoint rather than driver.slack_url (which would be circular), and the daily-file test proves the on-disk file name follows the configured timezone by inspecting real files. The two weak tests are intentionally not carried over: the tautological daily 'different date' test that compared two self-built string literals, and the Slack circular self-reference assertion.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Code review verdict: REQUEST CHANGES (do not merge yet) Substantive review passed — faithful pytest port:
Blocker — CI Ruff job is red ( |
|
Closing as superseded by #157. Both PRs port the logging tests from unittest to pytest and are functionally identical (52 tests, same assertions, #147 rigor preserved — no tautological daily test, Slack test pins the concrete endpoint). #157 is kept because it is already green (this PR had a red ruff-format CI), is cleaner (~113 fewer lines with a shared isolated_named_root fixture), and was confirmed equivalent in a direct diff comparison. Please use #157 instead. |
|
Closing as superseded by #157. Both PRs port the logging tests from unittest to pytest with identical test coverage (52 tests, same assertions, #147 rigor preserved), but #157 is already green on CI and slightly cleaner (shared |
Repurposes the idea behind PR #81 (cleaner pytest-style logging tests) while starting from the strong, mutation-verified suite added in #147 (commit 9d2d968).
What changed
Rewrote
fastapi_startkit/tests/logging/test_logging.pyfromunittest.TestCaseinto pytest style:class Test*groups with plainassertstatementssetUp/tearDownandsetUpModule/tearDownModule(module-scoped autouse boot fixture, per-class isolation fixtures for root-logger handlers and timezone)capsysreplaces manualredirect_stdoutRigor preserved (from #147)
https://slack.com/api/chat.postMessage, neverdriver.slack_url(the value that produced the call).Weaknesses intentionally NOT reintroduced
test_daily_channel_different_date_produces_new_file(compared two self-built string literals, never exercised channel behavior).Verification
pytest tests/logging/test_logging.py→ 52 passed