Skip to content
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

pytest: add latest fork parameter and exit gracefully upon an invalid fork #6

Conversation

danceratopz
Copy link
Owner

Requires #1.

This PR builds upon #1. In addition, it:

  1. Adds a custom exception InvalidForkError to ethereum_test_forks which is used to exit a pytest session gracefully if an invalid fork name is supplied to --latest-fork.
  2. Adds an additional line to the pytest header displayed in the console output to help inform users that they're running with an (unstable) upcoming fork, or not. Hopefully, this will help avoid confusions such as in EIP 6780 Tests ethereum/execution-spec-tests#122 (comment) (I've struggled with this myself).

About 2. If --latest-fork is not specified, then the line:

Only executing fillers with stable/deployed forks: Specify an upcoming fork via --latest-fork=fork to run experimental fillers.

is displayed in the header.
grafik

Otherwise, if --latest-fork is specified:

Executing fillers up to and including FORK.

is displayed.
grafik

@danceratopz
Copy link
Owner Author

We could isolate this functionality in it's own small pytest plugin, if we think that our conftest.py will get too unwieldy.

@danceratopz
Copy link
Owner Author

I refactored the latest-fork functionality to be it's own pytest plugin (located in src/pytest_plugins/latest_fork.py). I think this helps keep the code modular and keep the pytest config in conftest.py manageable.

…v2' into add-latest-fork-to-pytest-exit-gracefully
@danceratopz danceratopz merged commit 5a2fb9f into feature/use-pytest-to-collect-and-hydrate-test-fillers-v2 May 9, 2023
danceratopz pushed a commit that referenced this pull request May 12, 2023
@danceratopz danceratopz deleted the add-latest-fork-to-pytest-exit-gracefully branch June 23, 2023 06:42
danceratopz pushed a commit that referenced this pull request Aug 29, 2023
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.

2 participants