Skip to content

Conversation

@bodier123
Copy link

@bodier123 bodier123 commented Oct 28, 2025

Description

eest make test now formats the generated file with Ruff using the project config:

--config (AppConfig().ROOT_DIR.parent.parent / "pyproject.toml")

After #1654, ROOT_DIR points to packages/testing/src/execution_testing, while the project pyproject.toml lives at packages/testing/. Passing --config ensures the generated file matches repo style. The formatter runs right after the file is written.

Changes

  • Add _ruff_cmd(), _project_pyproject(), _ruff_format_file(path).
  • Call _ruff_format_file(module_path) after writing the file.
  • Guard: only pass --config if the file exists (installed envs won’t error).
  • Test: test_make_test_formatting.py asserts the Ruff CLI args.

Checks

  • uvx tox -e static (ruff, ruff format --check, mypy, ethereum-spec-lint)
  • Unit test passes

Closes #1675.

@danceratopz
Copy link
Member

Thanks @bodier123. I made a mistake in the title and description of the issue #1675 - sorry about that. The original issue should have referred to the gentest command, not the eest make test command. Most make test formatting issues should be resolved by the jinja2 templates, although some user input will break formatting (module title), so this PR still makes sense, imo, especially as we already have ruff as a depedency.

However, I would ask you to reuse and improve the function that calls ruff from gentest:
https://github.com/danceratopz/execution-specs/blob/15b5cfdfecdb66b525ca78379e9ad61bf54365bf/packages/testing/src/execution_testing/cli/gentest/source_code_generator.py#L54-L105

I would suggest that we move the format_code function to a shared module packages/testing/src/execution_testing/cli/shared/format_code.py. Then use it for both gentest and make test.

About the required improvements. Previously, gentest and make test were only intended to be ran within a clone in developer mode. If we want to make sure that they run correctly when executed from execution_testing as an installed package, then we need to remove the assumption that a pyproject.toml exists in one of the parent directories and we will need add the ruff required configuration directly to the format_code module. To do: Is it enough to specify the target line-length of 79? Or is there other ruff config we need to add? I.e., does the behavior of ruff format --check path/to/generated/source.py with minimal config match that with the pyproject.toml config?

Sorry for the confusion. I hope this helps clear things up. Lmk if you'd still like to work on this, if not I can help finish it off!

@danceratopz danceratopz self-assigned this Oct 29, 2025
@danceratopz
Copy link
Member

Hey @bodier123. As you might have noticed, a lot this repo is in flux at the moment due to The Weld. Another PR triggered this issue, which directly affects this PR. Please take it into consideration, if you work further on this 🙏

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.

Ensure uv run eest make test calls ruff and formats the generated test module correctly

2 participants