Skip to content

test: add test coverage for logging_config.py (#43)#45

Merged
microsasa merged 2 commits intomainfrom
test/logging-config-coverage-43-ad0fc8eb6509aa5b
Mar 14, 2026
Merged

test: add test coverage for logging_config.py (#43)#45
microsasa merged 2 commits intomainfrom
test/logging-config-coverage-43-ad0fc8eb6509aa5b

Conversation

@microsasa
Copy link
Owner

Closes #43

Changes

Adds tests/copilot_usage/test_logging_config.py with 7 tests covering all untested symbols in src/copilot_usage/logging_config.py:

setup_logging()

  • Removes existing handlers and adds exactly 1 sink
  • Is idempotent — calling twice still yields 1 sink
  • Targets sys.stderr
  • Sets minimum level to WARNING

_emoji_patcher()

  • Sets record["extra"]["emoji"] correctly for each known level in LEVEL_EMOJI
  • Falls back to " " for unknown level names

LEVEL_EMOJI

  • Contains entries for all 7 standard loguru levels: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL

Testing

All tests follow existing project conventions (type annotations, from __future__ import annotations, pyright ignore comments for private-member access).

Generated by Issue Implementer ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pypi.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pypi.org"

See Network Configuration for more information.

github-actions bot and others added 2 commits March 14, 2026 19:24
Add tests/copilot_usage/test_logging_config.py covering:
- setup_logging() adds exactly one sink
- setup_logging() is idempotent (no duplicate handlers)
- Sink targets sys.stderr at WARNING level
- _emoji_patcher sets correct emoji for all known levels
- _emoji_patcher falls back to '  ' for unknown levels
- LEVEL_EMOJI covers all seven standard loguru levels

Closes #43

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsasa microsasa marked this pull request as ready for review March 14, 2026 19:49
@microsasa microsasa requested a review from Copilot March 14, 2026 20:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds test coverage for src/copilot_usage/logging_config.py, which previously had zero tests despite being invoked on every CLI run. It addresses issue #43, adding 7 tests covering setup_logging(), _emoji_patcher(), and the LEVEL_EMOJI dictionary.

Changes:

  • Adds tests/copilot_usage/test_logging_config.py with 7 tests covering handler setup, idempotency, stderr targeting, log level, emoji patching for known/unknown levels, and standard level coverage in LEVEL_EMOJI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@microsasa microsasa merged commit a8dcedc into main Mar 14, 2026
8 checks passed
@microsasa microsasa deleted the test/logging-config-coverage-43-ad0fc8eb6509aa5b branch March 16, 2026 07:08
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.

[aw][test audit] logging_config.py has zero test coverage

2 participants