Skip to content

test(logging): port logging suite to pytest style#157

Open
tmgbedu wants to merge 1 commit into
mainfrom
task/pytest-style-logging-tests
Open

test(logging): port logging suite to pytest style#157
tmgbedu wants to merge 1 commit into
mainfrom
task/pytest-style-logging-tests

Conversation

@tmgbedu

@tmgbedu tmgbedu commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Refactors the logging test module (tests/logging/test_logging.py) from unittest into idiomatic pytest style, taking the cleaner ergonomics maintainers liked while keeping the current suite's full breadth and mutation-verified assertions.

Why

The unittest-based suite on main is comprehensive and well-verified, but reads heavier than it needs to (tempfile bookkeeping, redirect_stdout, self.assertX). This ports it to pytest fixtures/assert without losing a single test or weakening any assertion.

Conversions

  • unittest.TestCase classes → plain classes with bare assert
  • setUpModule / tearDownModule → module-scoped autouse booted_app fixture
  • per-class setUp / tearDown → fixtures (isolated_named_root, per-class snapshot_root)
  • tempfile.mkstemp / mkdtemptmp_path
  • redirect_stdout(io.StringIO())capsys
  • assertRaisespytest.raises; assertRegexre.search

Guarantees

  • All 52 tests preserved — same assertions, same subsystem coverage (channels, drivers, factories, facade, manager, handler, listener, config, file utils, provider, timezone-aware daily files).
  • Full suite: 1650 passed, 7 skipped.
  • Coverage 71.18%, clears the 68% fail_under gate.
  • ruff format + ruff check clean.
  • Net −60 lines.

Rewrite the logging test module in idiomatic pytest while preserving all
52 tests, their assertions, and subsystem breadth:

- unittest.TestCase classes -> plain classes with bare assert
- setUpModule/tearDownModule -> module-scoped autouse booted_app fixture
- per-class setUp/tearDown -> fixtures (isolated_named_root, snapshot_root)
- tempfile.mkstemp/mkdtemp -> tmp_path
- redirect_stdout(io.StringIO()) -> capsys
- assertRaises -> pytest.raises; assertRegex -> re.search

Coverage unchanged at 71.18% (>= 68% gate); full suite green.
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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