Skip to content

Conversation

@aryanpatil2703
Copy link

🗒️ Description

Make ruff formatting optional for code generated by gentest and eest make test. If ruff is not available, the code is returned/written unformatted, allowing package users to use these commands without requiring ruff as a dependency.

Changes:

  • Modified format_code() in gentest/source_code_generator.py to check for ruff availability and gracefully skip formatting if not found
  • Added _format_file_if_ruff_available() to eest make test command to optionally format generated files
  • Removed lint dependency group from tests_pytest_pypy3 tox environment

Testing:

  • Verified code is formatted when ruff is available (x=1+2x = 1 + 2)
  • Verified code is returned unformatted (without errors) when ruff is unavailable
  • Tested edge cases: ruff in venv, ruff in PATH, ruff not available, error handling
  • All linting checks pass: ruff check and ruff format --check verified

🔗 Related Issues or PRs

Fixes #1715

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:

    uvx tox -e static

    Note: tox -e static requires Python 3.11+ which may not be available in all local environments. However, all code quality checks have been verified:

    • ruff check: All checks passed ✓
    • ruff format --check: Files already formatted ✓
    • Manual testing: Functionality verified with and without ruff ✓
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.

    PR title: fix(gentest): make ruff formatting optional for generated code

  • All: Considered adding an entry to CHANGELOG.md.

    Not needed: This is a minor internal improvement that doesn't affect user-facing functionality.

  • All: Considered updating the online docs in the ./docs/ directory.

    Not needed: No documentation changes required for this internal improvement.

  • 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.

    Not applicable: No new tests added.

  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.

    Not applicable: No test cases added.

  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

    Not applicable: No tests ported.

Cute Animal Picture

Cute Animal

Update documentation to reflect package renaming from ethereum_test_* to
execution_testing.* namespace (follow-up to PR ethereum#1654).

Changes:
- Update module references in eip_testing_checklist_template.md
- Update directory structure in repository_overview.md

All module references now use the unified execution_testing.* namespace.
Make ruff formatting optional for code generated by gentest and eest make test.
If ruff is not available, the code is returned/written unformatted, allowing
package users to use these commands without requiring ruff as a dependency.

Changes:
- Modified format_code() in gentest to gracefully skip formatting if ruff
  is not available
- Added optional formatting to eest make test command
- Removed lint dependency group from tests_pytest_pypy3 tox env

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't format generated code from gentest and eest make test if ruff is not present

1 participant