test: add test coverage for logging_config.py (#43)#45
Merged
Conversation
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>
There was a problem hiding this comment.
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.pywith 7 tests covering handler setup, idempotency, stderr targeting, log level, emoji patching for known/unknown levels, and standard level coverage inLEVEL_EMOJI.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #43
Changes
Adds
tests/copilot_usage/test_logging_config.pywith 7 tests covering all untested symbols insrc/copilot_usage/logging_config.py:setup_logging()sys.stderrWARNING_emoji_patcher()record["extra"]["emoji"]correctly for each known level inLEVEL_EMOJI" "for unknown level namesLEVEL_EMOJITesting
All tests follow existing project conventions (type annotations,
from __future__ import annotations, pyright ignore comments for private-member access).Warning
The following domain was blocked by the firewall during workflow execution:
pypi.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.