cool-RR / PySnooper

Never use print for debugging again
MIT License
16.34k stars 951 forks source link

Feature/normalize output #170

Closed itraviv closed 4 years ago

itraviv commented 4 years ago

normalizing output - removing machine specific data:

absolute paths are replaced with the basename of the path.
time stamps are removed.
default (CPython) reprs of the form <.... at 0x[0-9a-fA-F] > will not contain the 'at 0x...' ending.

tests:

normalization does not affect the original test results so every test now runs with normalize=True
and normalize=False to preserve compatability.
assert_output can now verify the output of a normalized trace.

readme:

cool-RR commented 4 years ago

This looks excellent to me.

Two small notes:

  1. [False, True, ] should be (False, True)
  2. Where you're using except NotImplementedError you should use pytest.raises.
cool-RR commented 4 years ago

@alexmojaki if you feel like taking a look, feel free, if you're busy that's cool.

cool-RR commented 4 years ago

Wait, another note. Looking at the normalized output, I don't like how the code is now aligned with the variable changes. It's confusing. So when there's no datetime, instead of '', please use ' ' * 15. That way the alignment is preserved. I guess you'll need to change the tests a bit too. Please do all these changes in separate commits than what you've submitted so far, so I could easily compare them.

cool-RR commented 4 years ago

Good, the only thing that's left is that [False, True, ] should be (False, True)

itraviv commented 4 years ago

i swear it was there! 😒

cool-RR commented 4 years ago

Can you change it from (True, False, ) to (True, False)?

itraviv commented 4 years ago

Can you change it from (True, False, ) to (True, False)?

sure

cool-RR commented 4 years ago

@alexmojaki Let me know whether you have time to give it a look before I merge. (I'll squash Itamar's commits.)

alexmojaki commented 4 years ago

Go ahead.

cool-RR commented 4 years ago

I squashed these commits separately and made a release, adding Itamar to the authors file. Congrats on your first contribution!

itraviv commented 4 years ago

thanks!