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

Support pudb external breakpoint file #3

Open
wronglink opened this issue Sep 28, 2016 · 7 comments
Open

Support pudb external breakpoint file #3

wronglink opened this issue Sep 28, 2016 · 7 comments

Comments

@wronglink
Copy link
Owner

Load pudb external breakpoints file if --pudb parameter used.

@massich
Copy link

massich commented Jul 17, 2017

How is this done?

@wronglink
Copy link
Owner Author

Sorry, not yet. But I'll be happy to merge a PR for this feature.

@massich
Copy link

massich commented Jul 19, 2017

Any hints on how can I do that? (not the PR, but how should this be approached like where these files usually are when using pudb, whats their format.. you know couple of links to start digging)

@wronglink
Copy link
Owner Author

For sure. There are 2 main classes you need to work with: PuDB Debugger and it's base Bdb from python's library.

  1. Bdb has a method set_break() that sets breakpoint on the particular line.
  2. PuDB has some code to parse external breakpoints file (load_breakpoints() function that is called at PuDB debugger initialisation).
  3. Note, that running all code under the tracing hook will kill the execution performance. So there is a method Bdb.set_continue() that sets tracing hook only if there are breakpoints set.
  4. PuDB.set_trace() takes an optional parameter pause, that indicates whether debugger must stop at the current line or continue work, without stopping.
  5. Pytest has plugin hooks that we can stick to to start our code under debugger.

I think that the best solution would be to add some cmd parameter, that will mean two things:

  1. We need to parse breakpoints from the external file (I'd prefer pointing this file via that parameter than forcing user to put that file in the XDG_CONFIG_DIRS path that PuDB does).
  2. We need to start debugger tracing hook at the beginning of our tests run via pytest hook.

@majuscule
Copy link

Found this thread while looking for a similar but slightly different usecase. I believe that this issue is a prerequisite for the feature I'm looking for - but please let me know if I am mistaken.

It would be incredibly helpful for pytest-pudb to support pdb run style restarts with pytest --pudb created breakpoints. Specifically, when writing tests for an application it is rarely the test code that is in error, rather a supporting function that has already been invoked before the failing assertion. I don't believe that it is possible to backstep, but pudb does support easy jumps through the stacktrace via m that allow breakpoint creation at the suspected point of failure.

@deliciouslytyped
Copy link

This would be very useful for me.

@pyrrhull
Copy link

Is there any new development regarding the loading of external pudb breakpoints? I would be interested to get involved.

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

No branches or pull requests

5 participants