Conversation
…figArgParse into dev/add-more-cov-details
…figArgParse into dev/add-more-cov-details
…figArgParse into dev/add-more-cov-details
There was a problem hiding this comment.
Pull Request Overview
This PR enhances test coverage tracking by tagging coverage contexts per OS/Python version, updating dependencies and CI workflows to collect and combine coverage artifacts, and adding a coverage configuration file.
- Introduce an autouse pytest fixture to switch coverage contexts based on OS, Python version, and test name.
- Add
pytest-covto test dependencies and modify GitHub Actions to run pytest with coverage, upload per-matrix artifacts, and aggregate them in a separate job. - Include a
.coveragercwith coverage settings for sources, reports, and HTML output.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/conftest.py | Added an autouse fixture that tags and switches coverage contexts for each test based on OS and Python version. |
| setup.py | Included pytest-cov in the test extras. |
| .github/workflows/test.yml | Updated test steps to include coverage flags; added artifact upload and a new coverage job to combine results. |
| .coveragerc | Added coverage configuration for run, report, and HTML sections. |
Comments suppressed due to low confidence (3)
.github/workflows/test.yml:92
- The
geekyeggo/delete-artifactaction deletes remote artifacts from GitHub rather than cleaning up local files. Replace this with a local cleanup command, e.g.,run: rm -rf downloaded_artifacts, to avoid impacting shared artifact storage.
- name: Clean up temporary artifacts
tests/conftest.py:7
- [nitpick] Naming the fixture
covshadows pytest-cov's built-in fixture and may confuse readers. Consider renaming it to e.g.coverage_context.
def cov(cov, request):
tests/conftest.py:6
- The new coverage-context switching logic isn’t directly covered by any tests. Consider adding a unit test to verify that
cov.switch_contextis called with the expected context string.
@pytest.fixture(autouse=True)
tests/conftest.py
Outdated
| if not cov: | ||
| return | ||
|
|
||
| sys_context = "{}-py{}.{}".format(platform.system(), sys.version_info.major, sys.version_info.minor) |
There was a problem hiding this comment.
[nitpick] For improved readability and consistency with modern Python, consider using an f-string here instead of str.format().
| sys_context = "{}-py{}.{}".format(platform.system(), sys.version_info.major, sys.version_info.minor) | |
| sys_context = f"{platform.system()}-py{sys.version_info.major}.{sys.version_info.minor}" |
|
@kingbuzzman @tristanlatr any reason not to merge this? |
Yes. Because it doesn't work 🤦♂️🤣 While it looks amazing on paper, the context is being ignored in CI and well, it just strips it and gives you the regular "path/file.py::TestClass::test_func" -- still working on it, hence the "draft" 🤣 |
…figArgParse into dev/add-more-cov-details
Depends on: