pook icon indicating copy to clipboard operation
pook copied to clipboard

Disable PookNoMatch attempted matching output

Open henry-nextroll opened this issue 2 years ago • 1 comments

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:

  1. Why is this a feature?
  2. Does pook come with functionality to disable this or do I have to implement this myself?

Thanks, Henry

henry-nextroll avatar Sep 20 '21 17:09 henry-nextroll

I found I can disable the attempted matching logs via:

pook.api.debug(False)

However I am still curious why this is a feature.

henry-nextroll avatar Sep 21 '21 16:09 henry-nextroll

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.

sarayourfriend avatar Oct 26 '23 23:10 sarayourfriend

I'm closing this issue due to there not being any relevant changes to make for this. The workaround is available.

sarayourfriend avatar Dec 26 '23 02:12 sarayourfriend