Skip to content

Add plus no html skip generate html report - #285

Open
LeoAzLiu wants to merge 5 commits into
reporterplus:mainfrom
LeoAzLiu:281-add-plus-no-html-skip-generate-html-report
Open

Add plus no html skip generate html report#285
LeoAzLiu wants to merge 5 commits into
reporterplus:mainfrom
LeoAzLiu:281-add-plus-no-html-skip-generate-html-report

Conversation

@LeoAzLiu

@LeoAzLiu LeoAzLiu commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Close #281

  • Add --plus-no-html option to disable HTML report and disable open and email too.
  • Add doc descriptions.

I re-organize the options code to clear the usage. Please help to review.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytest_html_plus/plugin.py 73.33% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@reach2jeyan
reach2jeyan self-requested a review September 7, 2026 06:04
Comment thread docs/cli/cli.rst Outdated
Comment thread pytest_html_plus/plugin.py Outdated
f"Skipping HTML report generation."
)
return
if not session.config.getoption("--plus-no-html"):

@reach2jeyan reach2jeyan Sep 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoAzLiu we may have a problem here:
the current flow is

  • Screenshots are captured into the configured temporary screenshot directory, usually screenshots/.
  • Their paths are recorded in the JSON report.
  • The HTML generator finds those screenshots and copies them into report_output/screenshots/
  • The original temporary screenshots/ directory is deleted.
  • The generated HTML references the copied files under report_output/screenshots/.

With this introduction, I feel what would happen is, we will end up skipping step 3 and then still perform step 4, which means that, the screenshots would not get copied to report_output but at the same time delete the original screenshots folder which can cause data loss. We need to be able to decouple this or read this flag at that delete step and handle in this PR or let the user know that screenshots will not be created when html generation is disabled, given at the moment, we are not reading the screenshot file path in the vscode

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I prefer to keep the screenshots to report_output. I can try to handle this in this PR. Or anther before v1.3.0 to keep this PR been clear.

And I want covert to html and xml as python scripts. So if user want html or xml report can be possible. The command may like:

> pytest-html-plus final_report.json final_report.html

This will be break change. I have no idea if it possible or necessary.

@reach2jeyan reach2jeyan Sep 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoAzLiu XML generation is already optional through the --generate-xml flag. When enabled, users are explicitly opting into its additional processing and storage cost, which should be negligible.
One of our design principles is to minimize the number of steps users need to configure and execute. Requiring a second command to convert the generated JSON would add another step without providing much benefit. Users who need XML can enable the existing flag, while others avoid its small processing and storage cost.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I prefer to keep the screenshots to report_output.

Yes, keeping screenshots under report_output/screenshots/ is the preferred behavior. It keeps all generated artifacts together and ensures the JSON report does not reference files that are deleted during cleanup.
Please handle this in the current PR because the issue is introduced by the new --plus-no-html execution path. When HTML generation is skipped, the screenshots should still be copied to report_output/screenshots/ before the original screenshot directory is removed. Please also add a test covering this behavior.


# HTML options
group.addoption(
"--plus-email",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combining --plus-no-html with --plus-email silently disables email. Is this mentioned in the documentation? or do you suggest having validators in place for incompatible combinations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To balance the impact of two options --plus-email force generate html may be good choice. I will fix this and mention this in doc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still feel lets not force generate, this will again come at a cost in time. I would prefer to keep in the docs that, if they have no html, --plus email will not work. --plus email is essentially just for emailing the html report so if they use --no-html then they are making a concious decision that it wont be available for email

Comment thread CHANGELOG.md Outdated
@reach2jeyan

Copy link
Copy Markdown
Member

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytest_html_plus/plugin.py 73.33% 4 Missing ⚠️
📢 Thoughts on this report? Let us know!

@LeoAzLiu can you please see if you can address this?

@LeoAzLiu

LeoAzLiu commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.
Files with missing lines Patch % Lines
pytest_html_plus/plugin.py 73.33% 4 Missing ⚠️
📢 Thoughts on this report? Let us know!

@LeoAzLiu can you please see if you can address this?

This is false alarm. The coverage calculate the exception that have not been covered as my changes because i changed branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support option to skip generate html report

2 participants