-
Notifications
You must be signed in to change notification settings - Fork 117
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
feat(plugins): Refiller #1336
base: main
Are you sure you want to change the base?
feat(plugins): Refiller #1336
Conversation
) | ||
state_test(env=env, pre=pre, post={}, tx=tx) | ||
|
||
return test_state_filler |
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.
the function return itself?
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, the returned function is dynamically generated based on the properties of the specific static test that was read from the file.
): | ||
\"\"\"Generate a test from a static state filler.\"\"\" | ||
assert n == 1 | ||
assert m in [1, 2] |
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.
so it can call state_test(..) for each m, n ?
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 that is correct, you can parametrize it on the fly before returning the function:
@pytest.mark.parametrize("m", [1, 2, 3])
@pytest.mark.parametrize("n", [-1])
def test_fn(...
And the parametrization can be dynamic and depend on the values that you find in the state test filler for example.
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.
can you show an example how would it work from my test filler parser returning TestVector class. (the one that has env,pre,post,tx,id) ?
8e28d30
to
b2ee9c0
Compare
Here's the example to implement EOF static file readers: |
Currently, all tests are failing due to:
I feel like this should be ok for static legacy tests and only be a concern when actually porting the test to python. Wdyt @spencer-tb @danceratopz @winsvega ? |
🗒️ Description
Introduces the refiller plugin which is capable of loading static test specs from static files.
The plugin uses static specs which inherit from base in
src/ethereum_test_specs/base_static.py
.The inheriting classes must implement the
fill_function
method which returns the function that will be used by refiller to fill the static tests when the static file is loaded through the class.This PR contains no implementation of classes that inherit from the base static test class, and these should be implemented by follow-up PRs separately.
An (non-working) example can be seen in the following file: https://github.com/ethereum/execution-spec-tests/blob/filler-reader/src/ethereum_test_specs/state_json.py
Refiller mimics the normal python test filler id convention and therefore the files it loads must always contain sub-tests.
I.e. the loaded static test files must be a JSON/YAML with an object at root level, of which every key is a sub-test.
Example of test IDs from a static test file:
🔗 Related Issues
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.