-
Notifications
You must be signed in to change notification settings - Fork 8.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Add test coverage #2734
Comments
To give an idea of point n°5 above, the HTML pages of the code coverage report would look something like the following, showing a breakdown of how much each Python file in the repo is tested: Clicking on a file would give the detail of which lines of code are run during testing: Related issue: #2729. |
One of the goals of gym 1.1 (#2524) is to have full type hinting. |
Yes Mypy is nice for that, it can produce useful reports like below (not sure about Pyright either):
|
I'm starting to lean towards Pytest Coverage Comment as a good candidate to use in our PRs (solution n°6 in the first post). If there are no strong opinions against it I'll start a PR. |
Looking at the action, I noticed that it could report the number of warnings that |
Good catch, we should definitely add this if that's available! |
I'm having some issues in getting the coverage working with the current setup, for some reason the coverage number doesn't get computed and stays at 0%. But it seems I can get it to work either by installing Gym in editable mode with |
@kir0ul namespace packages still don't work in editable mode but this won't impact the Gym tests. All the ALE-specific tests are in our repository, not Gym. |
@JesseFarebro So does it mean we could get rid of the |
Yes, I don't see the issue there. This has become more so an issue for me when I'm testing the ALE. If you don't want to perform any ALE-related tests (which you shouldn't) then you don't need to make any compromises regarding namespace packages. The ALE should be the only namespace package that Gym supports, and this is just for backwards compatibility as people relied on the module path of |
@JesseFarebro Could this be a change at 1.0 to remove this backward compatibility? Would this help both projects? |
@pseudo-rnd-thoughts it could, I can keep backwards compatibility while deprecating the namespace package by conditionally registering the entry-point based on the Gym version. |
@pseudo-rnd-thoughts Apparently displaying the number of warnings in the report summary is not possible as it's not part of the JUnit XML format: MishaKav/pytest-coverage-comment#31 (comment). |
Related discussion: Farama-Foundation/Jumpy#7. |
Proposal
It would be nice to add somewhere a report of the test coverage.
Motivation
Currently there's no indication of the test coverage in Gym. This is a useful metric to get a sense of the code quality.
Pitch
Not sure what's the best way to implement this yet. As a bare minimum I would see a badge in the README showing the percentage of test coverage. We could also publish the HTML pages produced by
Coverage.py
/pytest-cov
and publish them with GH Pages to be able to quickly see the details of which lines of code are covered by testing and which are not. There are also online services that do that for you but they're usually not open source and I'm not a big fan of those vendor lock-in solutions.Ideally I think I would like to have a report on the PR reporting the trend of the test coverage after adding a new commit, so that developers know if the code quality is improving or deteriorating.
Possible solutions:
Checklist
The text was updated successfully, but these errors were encountered: