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

Tests print warnings #126

Closed
yurivict opened this issue Nov 25, 2020 · 2 comments
Closed

Tests print warnings #126

yurivict opened this issue Nov 25, 2020 · 2 comments

Comments

@yurivict
Copy link

tests/test_utils.py .............................................                                                                                                                      [100%]

====================================================================================== warnings summary ======================================================================================
tests/test_parse_string_function.py::test_parse_string_factory_raises_type_error_if_given_number[0]
  /usr/local/lib/python3.7/site-packages/hypothesis/extra/pytestplugin.py:171: HypothesisDeprecationWarning: tests/test_parse_string_function.py::test_parse_string_factory_raises_type_error_if_given_number[0] uses the 'parse_string_func' 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.
    msg % (item.nodeid, fx.argname), since="2020-02-29"

tests/test_parse_string_function.py::test_parse_string_factory_invariance[0-<lambda>]
  /usr/local/lib/python3.7/site-packages/hypothesis/extra/pytestplugin.py:171: HypothesisDeprecationWarning: tests/test_parse_string_function.py::test_parse_string_factory_invariance[0-<lambda>] uses the 'parse_string_func' 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.
    msg % (item.nodeid, fx.argname), since="2020-02-29"

tests/test_parse_string_function.py::test_parse_string_factory_invariance[48-<lambda>]
  /usr/local/lib/python3.7/site-packages/hypothesis/extra/pytestplugin.py:171: HypothesisDeprecationWarning: tests/test_parse_string_function.py::test_parse_string_factory_invariance[48-<lambda>] uses the 'parse_string_func' 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.
    msg % (item.nodeid, fx.argname), since="2020-02-29"

tests/test_parse_string_function.py::test_parse_string_factory_invariance[2147483696-<lambda>]
  /usr/local/lib/python3.7/site-packages/hypothesis/extra/pytestplugin.py:171: HypothesisDeprecationWarning: tests/test_parse_string_function.py::test_parse_string_factory_invariance[2147483696-<lambda>] uses the 'parse_string_func' 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.
    msg % (item.nodeid, fx.argname), since="2020-02-29"

-- Docs: https://docs.pytest.org/en/latest/warnings.html
========================================================================== 281 passed, 4 warnings in 27.71 seconds ===========================================================================

Version: 7.1.0
FreeBSD 12.2
Python-37

@SethMMorton
Copy link
Owner

SethMMorton commented Nov 26, 2020

I do not get these warnings neither locally nor in the CI. Can you be more specific about which pytest version you are using, as well as the extension versions?

@SethMMorton
Copy link
Owner

Ah, I bet you are ignoring the pinned development dependencies I have specified in dev/requirements.txt, so are using a newer version of hypothesis than I am using in my tests.

SethMMorton added a commit that referenced this issue Nov 27, 2020
- The SemVer function used in the examples was deprecated, so the
  suggested alternative is now used instead.
- Hypothesis apparently doesn't play well with function-scoped fixtures
  and has started warning about it - those tests have been rewritten.
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

No branches or pull requests

2 participants