Skip to content
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

Thoughts on how to solve for debugging tests? #2

Closed
thewatts opened this issue Oct 4, 2023 · 7 comments
Closed

Thoughts on how to solve for debugging tests? #2

thewatts opened this issue Oct 4, 2023 · 7 comments

Comments

@thewatts
Copy link

thewatts commented Oct 4, 2023

Hi there! 👋

I watched your pairing episode and started a sample project to poke around with TLDR. Really cool project!

Maybe this is just me - but I tend to do a lot of introspection to poke around in an object, test, etc - and pry is my debugger of choice.

To my initial surprise, throwing a binding.pry in my test - while it halted execution, the time bomb exploded shortly after. Upon digging into the code - this makes sense.

Wondering - would it be helpful to have a debugging flag? (similar to ENV["CI"])?

CleanShot 2023-10-04 at 15 43 59@2x
@coreyhaines
Copy link

coreyhaines commented Oct 4, 2023

There is a check for an IRB context, but I wonder if it doesn't detect whatever is needed for pry. Is there another context to check you can look into?

https://github.com/tendersearls/tldr/blob/main/lib/tldr/runner.rb#L28-L34

I wonder if you could check for something around Pry.current.
https://github.com/tendersearls/tldr/blob/main/lib/tldr/runner.rb#L28-L34

@coreyhaines
Copy link

Spent some time looking through the pry source to see if there was a straight-forward way (like it does with IRB) to detect if a pry session is happening, but wasn't successful. Hopefully someone else will have better luck finding the right check.

@coreyhaines
Copy link

LOL! I'm not saying to do this, but probably could use Thread.list in time_bomb and use Thread#thread_variable_get to check for the :pry_critical_section value > 0.

Something awful like

pry_running = Thread.list.any? { _1.thread_variable_get(:pry_critical_section).to_i > 0 }

Again, super LOL!

@searls
Copy link
Collaborator

searls commented Oct 5, 2023

Yes, we look out for IRB sessions but not for Pry, because AFAICT in binding.irb has become sophisticated enough to more or less obviate Pry.

I'm genuinely curious about what folks who are still using Pry with intention (as opposed to force of habit) in Ruby versions ~3.1 and later are getting out of it that IRB can't do. I've dropped Pry use entirely as a result, as well as that in recent years Pry maintenance has slowed way down and has resulted in more than a few bugs

@thewatts
Copy link
Author

thewatts commented Oct 7, 2023

Honestly, (and maybe this is just me) - but for whatever reason the color schemes I use and the autocomplete with IRB just do not mix (note: I'm partially colorblind).

It's what has kept me going back to pry.

I've tried both Darkula, and Catppuccin (current)
image

I've tried to figure out a way to fix this - but haven't had any luck thus far (and haven't yet added an issue in the project)

Update: I've submitted an issue with a question regarding how to fix this on the IRB project directly.

@searls
Copy link
Collaborator

searls commented Oct 8, 2023

@thewatts thanks for submitting the issue to the IRB project. Glad to see they seem to be on it

@searls searls closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2023
@st0012
Copy link

st0012 commented Oct 8, 2023

Copying my response from the IRB issue for exposure:

We’re aware of the problem and have started a discussion on introducing related APIs for customization in Reline (the gem that powers autocomplete dialog): ruby/reline#552

As a short-term solution, you can disable IRB's completion feature with:

  1. Setting IRB_USE_AUTOCOMPLETE=false environment variable
  2. Setting IRB.conf[:USE_AUTOCOMPLETE] = false in your PROJECT/.irbrc or ~/.irbrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants