Fixes #13666: Fix behavior for reports without test methods #13667
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.



Fixes: #13666
If you upload a report file without any test methods, the entire GUI for the reports page fails. This fixes the error by splitting up the
report_modulesinto valid and empty ones. The validreport_modules are rendered as before, the empty ones are listed with the possibility to delete them. (Before you had to drop into the CLI to delete them)The list of reports without test methods are at the top of the page to increase the visibility of them, but you could consider moving them into the normal list of reports, but show an error/warning there - similar to e.g. "Failed to load foo.py"
Additionally there is a second commit (But can be either dropped/moved to new PR as it changes the scope of the issue a little bit). It fixes the API by filtering out those reports
Note: I wasn't able to run black, as
black --config pyproject.toml netbox/wants to reformat everything, butpycodestyle --ignore=W504,E501 netbox/shows no warnings)