Make block_number configurable in genesis header again#2063
Conversation
| }, False) | ||
| ) | ||
| ) | ||
| def test_fill_header_params_from_parent(custom_header_params, null_parent, |
There was a problem hiding this comment.
The test cases look good here. We do try to avoid conditionals in our tests and instead split each test case out into their own test. With conditionals, it can be hard to read what test case ends where and to know which conditional is causing the test to pass over another without debugging the test, etc.
If we can split each test case out into its own test, with an explicit title of the thing it is testing, I think that would be ideal. We can probably factor out the parametrized test cases into a list and pass them into each test if they end up sharing similar info too... something like:
CUSTOM_HEADER_TEST_DATA = (
{
'gas_limit': 1,
'difficulty': 10,
...
},
{ ... },
{ ... },
)
@pytest.mark.parametrize('custom_header_params', CUSTOM_HEADER_TEST_DATA)
def test_case_1(custom_header_params):
...
@pytest.mark.parametrize('custom_header_params', CUSTOM_HEADER_TEST_DATA)
def test_case_2(custom_header_params):
...Thoughts?
|
Thanks for working this @catoenm! This looks good to me. I just left one refactor comment on the tests and then I can add a newsfragment and merge it 👌 |
What was wrong?
#2044
How was it fixed?
Fixed according to issue log.