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

Get Rid of Hypothesis Deprecation Warnings #1729

Closed
kclowes opened this issue Sep 4, 2020 · 10 comments
Closed

Get Rid of Hypothesis Deprecation Warnings #1729

kclowes opened this issue Sep 4, 2020 · 10 comments

Comments

@kclowes
Copy link
Collaborator

kclowes commented Sep 4, 2020

  • Version: 5.12.1

What was wrong?

At the end of our core tests, we have a Deprecation Warning that looks like:
HypothesisDeprecationWarning: tests/core/utilities/test_event_filter_builder.py::test_match_any_bytes_type_properties uses the 'web3' fixture, which is reset between function calls but not between test cases generated by @given(...). You can change it to a module- or session-scoped fixture if it is safe to reuse; if not we recommend using a context manager inside your test function. See https://docs.pytest.org/en/latest/fixture.html#sharing-test-data for details on fixture scope.

Actual output can be found in this test run.

How can it be fixed?

Add the appropriate scope to each fixture. This will need to be done in multiple PRs.

@tmckenzie51
Copy link
Contributor

I'm interested in working on this issue.

@marleypancakes
Copy link

Hello, does this issue still need fixing? Looking for a first contribution to make, and I would love to put my efforts towards Etherium:)

@kclowes
Copy link
Collaborator Author

kclowes commented Jun 16, 2021

Yes it does, and we'd love help! You can see the full list of warnings on any of the latest core test runs on CircleCI. The py36-core tests can be found here, and you can see the warnings in the run tox dropdown. I'd recommend tackling a few at a time so that we can review smaller PRs. Let us know if you need more direction!

@marleypancakes
Copy link

marleypancakes commented Jun 17, 2021

Couple of questions:

  1. Is this the correct way to define the scope of a fixture? (top line of the screenshot)

fixture_scope

  1. How can I determine the correct scope of each fixture?

@kclowes
Copy link
Collaborator Author

kclowes commented Jun 17, 2021

  1. Is this the correct way to define the scope of a fixture? (top line of the screenshot)

yep!

  1. How can I determine the correct scope of each fixture?

Since we're not having problems with the scope now, I'd start with the largest scope you can (which I believe is session, but I'm not sure on that) and then make the scope narrower as you run into issues. We've done a few of these before - this PR is a good example. We ended up moving all of the functions related to the Emitter fixture to a module scope, and moved it into the file where it was actually used. You'll likely need to do something similar. Let me know if you have more questions!

@smishy05
Copy link

Hey there @kclowes ! Has this issue been resolved? If no, then I would like to have a go at it?
Many thanks!

@kclowes
Copy link
Collaborator Author

kclowes commented Aug 19, 2021

@smishy05 It would be great if you wanted to have a go! Let me know if you have questions. Thanks!

@smishy05
Copy link

Thanks a lot for the reply! Yup, I will let you know if I face any issues.

kclowes added a commit that referenced this issue Dec 2, 2021
* Added conftest.py to test/core/utilities and moved web3 fixture to it
Moved fixtures into test_contract_topic_filter.py
Both of these were to fix HypothesisDeprecationWarning while running test

Co-authored-by: kclowes <kclowes@users.noreply.github.com>
@dbfreem
Copy link
Contributor

dbfreem commented Dec 16, 2021

@kclowes this issue can be closed.

@kclowes
Copy link
Collaborator Author

kclowes commented Dec 16, 2021

Thanks!

@kclowes kclowes closed this as completed Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants