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

async more filter tests #2732

Merged
merged 11 commits into from
Dec 2, 2022

Conversation

pacrob
Copy link
Contributor

@pacrob pacrob commented Nov 22, 2022

What was done?

Async more filter test files

Cute Animal Picture

image

@pacrob pacrob changed the title async existing filter test async more filter tests Nov 22, 2022
@pacrob pacrob changed the title async more filter tests [WIP] async more filter tests Nov 23, 2022
@pacrob pacrob force-pushed the further-async-filter-testing branch 2 times, most recently from 02c7e9e to 36e543a Compare November 30, 2022 19:08
@pacrob pacrob force-pushed the further-async-filter-testing branch from 36e543a to 959674e Compare November 30, 2022 20:20
@pacrob pacrob changed the title [WIP] async more filter tests async more filter tests Nov 30, 2022
Copy link
Collaborator

@kclowes kclowes left a 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.

@pytest.fixture(scope="module")
def async_create_filter(request):
return async_partial(return_filter)
async def async_return_filter(contract=None, args=[]):
Copy link
Collaborator

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?

Suggested change
async def async_return_filter(contract=None, args=[]):
async def async_return_filter(contract, args):

or even pass in event_name and _kwargs directly:

Suggested change
async def async_return_filter(contract=None, args=[]):
async def async_return_filter(contract, event_name, _kwargs):

Copy link
Collaborator

@fselmo fselmo Dec 2, 2022

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

Copy link
Contributor Author

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(
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

@fselmo fselmo left a 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.

@pytest.fixture(scope="module")
def async_create_filter(request):
return async_partial(return_filter)
async def async_return_filter(contract=None, args=[]):
Copy link
Collaborator

@fselmo fselmo Dec 2, 2022

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

@pacrob pacrob merged commit 239a752 into ethereum:asyncify-filters Dec 2, 2022
@pacrob pacrob deleted the further-async-filter-testing branch December 2, 2022 21:12
pacrob added a commit that referenced this pull request Dec 2, 2022
* 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
pacrob added a commit to pacrob/web3.py that referenced this pull request Dec 2, 2022
* 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
pacrob added a commit to pacrob/web3.py that referenced this pull request Dec 2, 2022
* 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
pacrob added a commit to pacrob/web3.py that referenced this pull request Dec 8, 2022
* 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
pacrob added a commit that referenced this pull request Dec 19, 2022
* 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
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.

3 participants