Use pdb with green #72
Replies: 12 comments
-
Off the top of my head, I have no idea. Green launches the actual tests in one or more subprocesses for scalability reasons, which is almost certainly why you're seeing stuff get ignored. Perhaps there is some way we could make green pass pdb through to a single subprocess to make such a thing work. I'm open to suggestions! In the short term, you could just sidestep green and import and run your test functions directly with pdb. |
Beta Was this translation helpful? Give feedback.
-
This is a deal breaker :( My experience with |
Beta Was this translation helpful? Give feedback.
-
That's a great start. I'll see what they did. I also have a coworker who has done some interesting things with remote-debugging with pdb, so I now know it's definitely possible to attach a debugger to an arbitrary process...somehow. I'd love to give this enhancement a shot once I finish addressing the outstanding issues. |
Beta Was this translation helpful? Give feedback.
-
Same here with ipdb. It is indeed a deal breaker. |
Beta Was this translation helpful? Give feedback.
-
+1 Same issue. Have you guys any solution about this one inside green? |
Beta Was this translation helpful? Give feedback.
-
I never have made it to researching this one. If anyone has already figured something out with pdb, please let me know as I would love to use your experience as a starting place for making this work. |
Beta Was this translation helpful? Give feedback.
-
I'm comming from ruby community, so I'm not experienced with python, and less with pdb itself. However, I've seen some approaches using ruby's |
Beta Was this translation helpful? Give feedback.
-
Man, I'd really love to see this feature on green! Currently I'm using invoke to not run django tests with green when there's an ipdb breakpoint |
Beta Was this translation helpful? Give feedback.
-
@CleanCut I looked at nose.set_trace() and noticed that they restored the Copying and pasting the code for easy referencing:
https://github.com/nose-devs/nose/blob/master/nose/tools/nontrivial.py#L73 |
Beta Was this translation helpful? Give feedback.
-
@alexandrebarbaruiva Yes, Green captures stdout by replacing saving and replacing the value of You should also note that Green has the additional complication that it coordinates the entire run in a main process, but actually runs tests in a subprocess (actually I would naively guess that enabling pdb support in Green would involve restricting the number of test-running subprocesses to 1 (which could easily be done at argument-parsing time) and then finding a way to connect to the one subprocess which is actually running the tests. |
Beta Was this translation helpful? Give feedback.
-
@alexandrebarbaruiva A couple comments about this code:
In any case, I welcome further investigation and/or work towards enabling using pdb! 😄 |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to debug a test. I usually inset break points using the pdb library. Green seems to swallow up those break points and skip right over them.
How can I use
import pdb; pdb.set_trace()
in combination with green tests?Beta Was this translation helpful? Give feedback.
All reactions