pook
pook copied to clipboard
Disable PookNoMatch attempted matching output
Hello,
Whenever I run into the classic PookNoMatches
error, it seems like pook
will try to show the "closest" mock that exists that is similar to the request that was just made. 99.9% of the time, the "closest" mock is not even remotely similar to what I just made, and my terminal is basically filled up with more confusing than helpful text. My questions are:
- Why is this a feature?
- Does pook come with functionality to disable this or do I have to implement this myself?
Thanks, Henry
I found I can disable the attempted matching logs via:
pook.api.debug(False)
However I am still curious why this is a feature.
Hi Henry. I've personally found this feature useful precisely when a mock is slightly misconfigured. For example, I've run into issues with a particular path configuration not creating the matcher I expected, and it was helpful to have that logging. I've also found it useful when pook unexpectedly intercepts requests that I didn't intend for it to intercept (i.e., because it was on when I didn't expect it to be).
Do you have a suggestion for how to improve this feature? It would be a significant change to remove it entirely, but I could see an argument for reversing the default and only outputting the full debug text when pook.api.debug
is explicitly turned on. However, in that case, would you suggest an alternative "minimal" logging output? I haven't run into the same issues with it as you, so I'm struggling to think of appropriate alternatives.
I'm closing this issue due to there not being any relevant changes to make for this. The workaround is available.