-
Notifications
You must be signed in to change notification settings - Fork 167
chores(src): nuke fixtures dir when html is disabled and no tests were filled #2014
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, just one comment to make this a bit safer, but in general I think it's a good idea 👍
src/pytest_plugins/filler/filler.py
Outdated
# * no tests were filled | ||
html_output_is_enabled = getattr(session.config.option, "htmlpath", None) | ||
if not html_output_is_enabled: | ||
shutil.rmtree("fixtures") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the FixtureOutput
object from src/pytest_plugins/filler/fixture_output.py
to determine the appropriate folder to drop here because, while the default is indeed fixtures
, it really depends on the --output
flag of the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right, thanks. I have added it
c1019a3
to
8190086
Compare
Thanks for tackling this @felix314159! It's a reasonable approach, but I'd prefer if we could avoid output even without having to specify
Are you insisting on |
yes i agree it would be better if it worked no matter whether an html flag passed or not, but i couldn't get it to work that way. i already tried what you linked, adding the trylast thing did not resolve it. but i also am not an expert at pytest hooks. how about this: my experience with html summaries has been that either i don't look at them or that i want to look at them but they are so large in size (>50MB) that they crash my browser when i try to open them. so another option to make everyone happy would be to invert the html flag (the report generation is disabled by default, but you can toggle it on with --enable-html). this way the average user is happy with the ducktape solution this PR is and advanced users know that they can the html flag to get the old behavior back. |
Yes, I think it's time to remove enabling the html reports by default. In that case, I would not patch the |
@felix314159 It crossed my mind why using Still open to disabling html output by default instead of the PR above, but I think this PR, as it stands, doesn't fully solve the underlying issue. |
Thanks for looking into this, I am fine with either solution. I will close this now |
@felix314159 Aha, the PR above was a PR to yours, sorry, didn't mean to hijack this PR entirely. But ok, I pointed the branch from |
🗒️ Description
Fixes #1613 but only under the condition that you add
--no-html
to your command.LMK what you think, another alternative would have been to somehow attach to the pytest-html plugin and at the end of that detect whether any tests have been written or not and let it perform the nuke, but that seemed overly complicated.
The general problem is that the html plugin just assumes that it can write to the fixtures dir, so nuking it no matter what would create problems if this PR would not also check whether
--no-html
had been passed or not.LMK what you think.
How to reproduce
uv run fill --fork Frontier tests/istanbul/eip1344_chainid/ -s -v --clean --no-html --output=./testoutput
uv run fill --fork Frontier tests/istanbul/eip1344_chainid/ -s -v --clean
uv run fill --fork istanbul tests/istanbul/eip1344_chainid/ -s -v --clean
LMK what you think
🔗 Related Issues or PRs
Fixes #1613
fill
generates a.meta
directory even if no tests executed #1613✅ Checklist
tox
checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
type(scope):
.mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_from
marker.