Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felix314159
Copy link
Collaborator

@felix314159 felix314159 commented Aug 8, 2025

🗒️ 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

  • Before: creates useless testoutput folder with html report etc
  • After: No new folder is created

uv run fill --fork Frontier tests/istanbul/eip1344_chainid/ -s -v --clean

  • Before & after: creates a bunch of useless files

uv run fill --fork istanbul tests/istanbul/eip1344_chainid/ -s -v --clean

  • Before & after: Fills tests as expected

LMK what you think

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast 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
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered adding an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Copy link
Member

@marioevz marioevz left a 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 👍

# * no tests were filled
html_output_is_enabled = getattr(session.config.option, "htmlpath", None)
if not html_output_is_enabled:
shutil.rmtree("fixtures")
Copy link
Member

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.

Copy link
Collaborator Author

@felix314159 felix314159 Aug 12, 2025

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

@felix314159 felix314159 force-pushed the fixtures-dir-nuked-when-nothing-was-filled-and-html-disabled branch from c1019a3 to 8190086 Compare August 12, 2025 08:47
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.

bug(fill): fill generates a .meta directory even if no tests executed
2 participants