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

Deprecation warning does not blame user code correctly #652

Closed
mithrandi opened this issue May 27, 2017 · 2 comments
Closed

Deprecation warning does not blame user code correctly #652

mithrandi opened this issue May 27, 2017 · 2 comments
Assignees
Labels
bug something is clearly wrong here legibility make errors helpful and Hypothesis grokable

Comments

@mithrandi
Copy link
Contributor

From IRC:

<idnar> …/hypothesis/searchstrategy/deferred.py:81: HypothesisDeprecationWarning: Use hypothesis.strategies.datetimes, which supports full-precision bounds and has a simpler API.
<idnar> that message doesn't actually tell me _what_ is deprecated
<tos9> idnar: It's hypothesis.extras.datetime.datetimes that's deprecated
<tos9> But I think all the warnings are possibly missing a stacklevel
<tos9> because they don't point at the calling code
@Zac-HD Zac-HD added the bug something is clearly wrong here label Oct 8, 2017
@Zac-HD
Copy link
Member

Zac-HD commented Oct 8, 2017

from hypothesis.extra.datetime import datetimes
datetimes().example()

gives a warning pointing into Hypothesis internals.

However, I think this is due to lazy evaluation rather than a stack error as such; and the proper fix is probably to address the deeper issue of misattributed exceptions in deferred strategy creation.

@Zac-HD Zac-HD added the legibility make errors helpful and Hypothesis grokable label Feb 25, 2018
@Zac-HD Zac-HD self-assigned this Sep 29, 2018
@Zac-HD
Copy link
Member

Zac-HD commented Sep 29, 2018

Nope, turns out it's a lot simpler than that - purely a presentation issue where we should pass stacklevel=2 but currently have stacklevel=3; the traceback is fine but we've told the warnings machinery not to display the relevant frame! Fix incoming 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here legibility make errors helpful and Hypothesis grokable
Projects
None yet
Development

No branches or pull requests

2 participants