Add pytest-cov coverage measurement and tests for log_utils.py#92
Merged
Add pytest-cov coverage measurement and tests for log_utils.py#92
Conversation
Co-authored-by: dgenio <12731907+dgenio@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add pytest-cov coverage measurement and tests for log_utils.py
Add pytest-cov coverage measurement and tests for log_utils.py
Mar 9, 2026
There was a problem hiding this comment.
Pull request overview
This PR strengthens the project’s testing discipline by enabling automatic coverage measurement on every pytest run and adding dedicated unit tests for chainweaver.log_utils (the structured step-logging helpers used by the executor).
Changes:
- Enforce coverage measurement + minimum threshold via
pytestconfig (--cov=chainweaver --cov-report=term-missing --cov-fail-under=80). - Add a new
tests/test_log_utils.pysuite that exercisesget_logger,log_step_start,log_step_end, andlog_step_errorusingcaplog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pyproject.toml |
Adds pytest addopts so coverage is always collected and a minimum threshold is enforced. |
tests/test_log_utils.py |
Adds targeted tests validating that log utilities emit correctly leveled, structured messages. |
You can also share your feedback on Copilot code review. Take the survey.
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.
No coverage measurement existed in the test suite, and
chainweaver/log_utils.py(83 lines, 4 public functions) had zero dedicated tests.Changes
pyproject.tomladdoptsto[tool.pytest.ini_options]to enforce coverage on everypytestrun:tests/test_log_utils.py(new)log_utils.py:TestGetLogger— return type, name binding, identity semanticsTestLogStepStart— INFO level, step index, tool name, inputs,STARTmarkerTestLogStepEnd— INFO level, step index, tool name, outputs,ENDmarkerTestLogStepError— ERROR level, step index, tool name, exception type/message,ERRORmarkercaplogfixture for log capture; consistent with existing test conventionsResult
Full suite: 66 tests, 98.6% coverage — threshold of 80% is met with significant headroom.
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.