-
Notifications
You must be signed in to change notification settings - Fork 578
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
how to filter invalid result from the target efficiently? #3811
Comments
A couple of suggestions: Instead of returning
However, that will probably not fix the problem, it just stops it propagating into the bundle. The real fix would be to amend the strategy itself to be less likely to produce invalid file names in the first place. For example, if forward slashes are known to be invalid then they can maybe be removed or replaced after they are generated, without invalidating the entire example:
This can be expressed as a reusable custom valid-file-name strategy. [edit] Maybe I'm misunderstanding, and you want those invalid filenames as part of the test. If so, just drop the filter and unlink conditionally within the function. |
Instead of As a separate tip, you might find the I'd avoid using |
Thanks a lot, return multiple() works perfect for me. |
Consume it, return multiple() if unlink succeeded, or the file if unlink failed (so that it's put back into the bundle) |
Thanks, it is very good idea for me! |
I use stateful machine test posix compatibility between /tmp/ and jfs file system, I do operations like create_file and unlink etc for the two file system, and compare their result or exception strings.
The problem is when it fails in create file, I will return INVALID_FILE_PATH for the target, and then I filter the INVALID_FILE_PATH in unlink in order to not unlink a non-exist file。
But in this way, it will filter too much data and make the test inefficient, and hypothesis will give the error hypothesis.errors.FailedHealthCheck error: It looks like your strategy is filtering out a lot of data...
So what can I handle this case? Is there a way to filter the non-exist files from the target efficiently?
The text was updated successfully, but these errors were encountered: