Skip to content

Adjust post_test_case_hook scope#4022

Merged
Liam-DeVoe merged 6 commits intoHypothesisWorks:masterfrom
Liam-DeVoe:post-test-case-hook-fix
Jun 29, 2024
Merged

Adjust post_test_case_hook scope#4022
Liam-DeVoe merged 6 commits intoHypothesisWorks:masterfrom
Liam-DeVoe:post-test-case-hook-fix

Conversation

@Liam-DeVoe
Copy link
Copy Markdown
Member

Move post_test_case_hook higher up so it correctly handles symbolic lifetimes. Reported in pschanely/CrossHair#263, regressed in #3977.

Also includes a bandaid for flakiness when replaying interesting non-hypothesis backend examples. I ran into this when we flakily raised DeadlineExceeded with the crosshair backend. I think probably we want to raise Flaky here instead of silently exiting though.

Copy link
Copy Markdown
Member

@Zac-HD Zac-HD 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 great - thanks for the fix @tybug!

Should we also try to run with crosshair in CI? That would have caught this at the time, and I think we could probably run most of our coverage tests with crosshair...

Comment on lines +512 to +514
# should we raise Flaky here instead?
if data.status != Status.INTERESTING:
self.exit_with(ExitReason.flaky)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think exit-flaky is correct, but we'll also need a covering test 🙂

Copy link
Copy Markdown
Member Author

@Liam-DeVoe Liam-DeVoe Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just exiting is a silent conclusion of the run, so after looking at it I think we do not want this. I put a stop-gap flaky raise but we lose eg the nice custom deadline reporting we get at the StateForActualGivenExecution level. I don't see an easy way to thread things through at this lower level but I am also having a hard time keeping the engine control flow graph straight. I think this is acceptable for now.

(also added a test)

@Liam-DeVoe
Copy link
Copy Markdown
Member Author

Liam-DeVoe commented Jun 27, 2024

Should we also try to run with crosshair in CI?

Would definitely like to work towards this. I've started taking a look at the remaining blockers here, of which pschanely/hypothesis-crosshair#6 is one.

Copy link
Copy Markdown
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; as you say it'd be nice to upgrade this later but the PR is a clear improvement on status quo, so lets merge!

(I'd like to have this out before I give a talk about it tomorrow 😉)

Comment thread hypothesis-python/src/hypothesis/internal/conjecture/engine.py Outdated
@Liam-DeVoe Liam-DeVoe force-pushed the post-test-case-hook-fix branch 2 times, most recently from e53bd2f to 9f5a9ed Compare June 28, 2024 21:11
@Liam-DeVoe
Copy link
Copy Markdown
Member Author

hold off on this for a sec, the new check doesn't play nicely with symbolic-typed values from crosshair.

@Liam-DeVoe Liam-DeVoe force-pushed the post-test-case-hook-fix branch from 9f5a9ed to 1f86be4 Compare June 29, 2024 03:44
@Liam-DeVoe
Copy link
Copy Markdown
Member Author

assert type(node.value) is crosshair.libimpl.builtinslib.SymbolicBool

And this is a good reason to be carrying around ir_type separately instead of retrieving it from type(value)!

@Liam-DeVoe Liam-DeVoe enabled auto-merge June 29, 2024 03:46
@Liam-DeVoe Liam-DeVoe merged commit c79e893 into HypothesisWorks:master Jun 29, 2024
@Liam-DeVoe Liam-DeVoe deleted the post-test-case-hook-fix branch June 29, 2024 05:27
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.

2 participants