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

Stateful printing referring to undefined variable #2341

Closed
bmerry opened this issue Feb 4, 2020 · 1 comment · Fixed by #2363
Closed

Stateful printing referring to undefined variable #2341

bmerry opened this issue Feb 4, 2020 · 1 comment · Fixed by #2363
Assignees
Labels
bug something is clearly wrong here

Comments

@bmerry
Copy link

bmerry commented Feb 4, 2020

Run this example with pytest (hypothesis 5.4.1, but also seen with 4.57.1):

import hypothesis.strategies as st
from hypothesis.stateful import RuleBasedStateMachine, Bundle, initialize, rule


class MyStateMachine(RuleBasedStateMachine):
    data = Bundle('data')

    @initialize(target=data, value=st.integers())
    def init_data(self, value):
        return value

    @rule(d=data)
    def mostly_fails(self, d):
        assert d == 42


Test = MyStateMachine.TestCase

It reports this falsifying example:

Falsifying example:
state = MyStateMachine()
v1 = state.init_data(value=v1)
state.mostly_fails(d=v1)
state.teardown()

But v1 is never initially defined.

bmerry added a commit to jamesls/fakeredis that referenced this issue Feb 4, 2020
This reverts commit b36edbe.

It is worse for debugging due to HypothesisWorks/hypothesis#2341.
@Zac-HD Zac-HD added the bug something is clearly wrong here label Feb 4, 2020
@Zac-HD
Copy link
Member

Zac-HD commented Feb 15, 2020

Blocked on #2332, because I don't want to try to deal with merge conflicts between a bugfix and the big refactoring. It's a high priority after that though!

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants