Enhance HTML report generation with test results - #1
Open
FinSecTech wants to merge 6 commits into
Open
FinSecTech wants to merge 6 commits into
FinSecTech wants to merge 6 commits into
Conversation
`pytest_terminal_summary` now falls back to `terminalreporter.stats` when `_test_results` is empty, rebuilding results from the terminal reporter's aggregated data (which xdist does populate). Also added a discard for the unused `exitstatus` parameter.
…fore. Some bugs have been fixed..
…fore. Some bugs have been fixed.
- `HTMLGeneratorDashboard.__init__()` now accepts a `parallel_execution="No"` keyword arg and stores it.
- `generate_test_configuration_section()` now renders `{self.parallel_execution}` instead of hardcoded `"No"`.
- `enhance_html_report_dashboard()` passes the kwarg through to the constructor.
- `error_reporter.get_error_info(test_id)` does not exist. The method is called `get_test_errors(test_id)`. Fix: Changed to `error_reporter.get_test_errors(test_id)`.
After running tests with `-n=4`, the report will display `Parallel Execution: 4 workers` instead of `No`.
…fore. Some bugs have been fixed. - In `pytest_terminal_summary`, the code now reads `config.option.numprocesses` (the attribute set by pytest-xdist's `-n` flag). If it's set and > 0, it sends "N workers" to the HTML generator; otherwise "No". - When xdist runs tests in worker processes, the controller's `EnhancedErrorReporter` is empty because `pytest_runtest_makereport` (which captures error data) only runs in workers. The "View Error" popups showed nothing useful. Fix: After rebuilding `test_results` from `terminalreporter.stats`, inject error details from the deserialized `TestReport.longrepr` into the controller's `EnhancedErrorReporter`. - `pytest_sessionfinish` checks `if _history_tracker and _test_results:`, but with xdist, `_test_results` is empty in the controller (only populated in workers). So no history was ever saved for xdist runs. Fix: After rebuilding `test_results` from `terminalreporter.stats`, save the run to the history database directly from `pytest_terminal_summary`. History, flaky test detection, and trend data now work with xdist.
Injected screenshots into the dashboard's data pipeline. Modified the dashboard's HTML generator to display them.
Injected screenshots into the dashboard's data pipeline. Modified the dashboard's HTML generator to display them.
Owner
|
@FinSecTech Thanks for your contribution. Please check above 15 errors from pre-commit validation. kindle fix those and send me updated pull request to merge. File "/home/runner/work/pytest-html-dashboard/pytest-html-dashboard/src/pytest_html_dashboard/init.py", line 12, in |
This branch has not been deployed
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.
pytest_terminal_summarynow falls back toterminalreporter.statswhen_test_resultsis empty, rebuilding results from the terminal reporter's aggregated data (which xdist does populate). Also added a discard for the unusedexitstatusparameter.