-
Notifications
You must be signed in to change notification settings - Fork 43
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
Verbose ergonomics on exceptions #126
Conversation
@alfert I found a workaround to put the output where it belongs. By gathering the output in an extra process, started within the properties macro, we can make This is obviously rather hacky and building on us sharing information between Note that this PR does not yet implement a |
Start the agent. | ||
""" | ||
def start_link do | ||
Agent.start_link(&MapSet.new/0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use a MapSet
here to reduce the verbosity on shrinking. Otherwise, if we hit the exception on every attempt to shrink, the output will be large. Note however that the stacktraces in the assert_test.exs
are apparently not always the same, so there is still more output than there should be.
daea19c
to
36b3c9c
Compare
If you want to test this locally, you can run |
36b3c9c
to
560c6bb
Compare
If I read your code correctly, then there is no process dictionary involved. I follow Joe Armstrong here and would avoid it under nearly any cost. |
Silly github question: Is the force push really required all the time? I usually don't do this unless I amend something. |
The process dictionary is involved, but the change is hidden in this PR. The |
I amended the commit where |
I see, but this was already ok and its only configuration data. Go ahead! |
I still don't like using the process dictionary too much, but I also did not find any other way yet to share options between different macros :( I will make this PR work with travis. What do you think of the hack |
I have mixed feelings. The clean up - if required - should be done in our |
We currently support other options there as well, e.g. Placing the clean up in
I did not do that in order to avoid spill-over output between different tests, and to allow tests running concurrently. If tests are run concurrently and if the output agent is a singleton, the output agent must take care to split the outputs of different tests. This should be doable by passing in an identifier (e.g. a hash) for a test. I can give that a try if you prefer that to cleaning up the options. |
Then let's place the cleanup in
I see and I did not get this detail last night. Let's running several agents in parallel (which makes really sense) and we profit from the BEAM architecture, yeah! Please go ahead! |
Some more thoughts on a flag to enable/disable this:
|
I agree to both
Von unterwegs gesendet
… Am 24.10.2019 um 20:17 schrieb Magnus ***@***.***>:
Some more thoughts on a flag to enable/disable this:
I think detect_exceptions might be a better name than silence_exceptions. What do you think?
Similarly to verbosity, I think an environment variable such as PROPCHECK_DETECT_EXCEPTIONS would be nice.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
And one more thought: If an |
I implemented the changes (but did not yet change the behaviour on assert for now). Note that the output can grow arbitrarily large if the detected error is changing during shrinking. For example, the following results in a lot of exceptions being detected: # Shrinking might take a lot of steps to find a counter example
property "lengthy output?", [numtests: 10000] do
forall n <- integer(1, :inf) do
if n > 500 && rem(n, 2) == 0 do
raise "#{n}"
else
true
end
end
end I therefore set |
46b1bb6
to
2a3e08b
Compare
77c9b5e
to
a5bca89
Compare
Looks like we done, aren't we? It's a cool addition to the feature set. |
Yes, I am pretty happy about this change now. |
This pull request implements a crude exception detection for PropCheck. It adds an agent started within
property
to capture additional output which we might want to display in the error message.This is an attempt to fix #110.