-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
async more filter tests #2732
async more filter tests #2732
Conversation
02c7e9e
to
36e543a
Compare
36e543a
to
959674e
Compare
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.
This looks generally good to me! I left some comments, mostly out of curiosity since all the tests look like they're running fine.
tests/core/filtering/conftest.py
Outdated
@pytest.fixture(scope="module") | ||
def async_create_filter(request): | ||
return async_partial(return_filter) | ||
async def async_return_filter(contract=None, args=[]): |
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.
I don't think it makes sense to have default values for contract
and args
here since we don't account for those values in the function. For example, if args = []
, line 200 below will raise an IndexError
. What do you think about removing the default values?
async def async_return_filter(contract=None, args=[]): | |
async def async_return_filter(contract, args): |
or even pass in event_name
and _kwargs
directly:
async def async_return_filter(contract=None, args=[]): | |
async def async_return_filter(contract, event_name, _kwargs): |
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.
+1 for @kclowes' comments here
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.
I went with first option, changed in the sync version I copied it from too.
|
||
@pytest.fixture(scope="module") | ||
def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): | ||
return _emitter_fixture_logic( |
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.
nit: I'm not sure I see the value in having a function just pass on it's args to another function. Can we move the logic back here and avoid some indirection? Alternatively, if this is used in more places than it looks like it is in this PR, can we pull the fixture up a few levels?
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 other use is in the local conftest.py
, which came through in the previous PR. The fixture is redefined here due to scope. I had pulled the logic of the longer fixtures out to utils.py
to avoid duplication. It is only used twice though, so I'm happy to move the logic back if you would prefer.
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.
And I'll aim to have these sorts of related changes come through in a single PR in the future.
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.
Ah, right. I forgot about those warnings. I don't have a strong preference either way. I think the real fix is to figure out why we can't use this fixture on the higher levels without warnings. I just added another bullet point to issue #2460 to look into this.
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.
In this case, it's hypothesis that has issues with the fixture scope. Not sure about other cases.
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.
lgtm 👍🏼. Don't have anything else to add here.
tests/core/filtering/conftest.py
Outdated
@pytest.fixture(scope="module") | ||
def async_create_filter(request): | ||
return async_partial(return_filter) | ||
async def async_return_filter(contract=None, args=[]): |
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.
+1 for @kclowes' comments here
* async existing filter test * async test_filter_against_transaction_logs * async test_filter_against_pending_transactions * async test_contract_get_logs * async test_contract_topic_filters * async test_contract_past_event_filtering * async test_contract_on_event_filtering * async test_contract_data_filters
* async existing filter test * async test_filter_against_transaction_logs * async test_filter_against_pending_transactions * async test_contract_get_logs * async test_contract_topic_filters * async test_contract_past_event_filtering * async test_contract_on_event_filtering * async test_contract_data_filters
* async existing filter test * async test_filter_against_transaction_logs * async test_filter_against_pending_transactions * async test_contract_get_logs * async test_contract_topic_filters * async test_contract_past_event_filtering * async test_contract_on_event_filtering * async test_contract_data_filters
* async existing filter test * async test_filter_against_transaction_logs * async test_filter_against_pending_transactions * async test_contract_get_logs * async test_contract_topic_filters * async test_contract_past_event_filtering * async test_contract_on_event_filtering * async test_contract_data_filters
* async existing filter test * async test_filter_against_transaction_logs * async test_filter_against_pending_transactions * async test_contract_get_logs * async test_contract_topic_filters * async test_contract_past_event_filtering * async test_contract_on_event_filtering * async test_contract_data_filters
What was done?
Async more filter test files
Cute Animal Picture