Giter Club home page Giter Club logo

Comments (7)

majuscule avatar majuscule commented on June 24, 2024 2

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.

from pytest-pudb.

deliciouslytyped avatar deliciouslytyped commented on June 24, 2024 1

This would be very useful for me.

from pytest-pudb.

pyrrhull avatar pyrrhull commented on June 24, 2024 1

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

from pytest-pudb.

massich avatar massich commented on June 24, 2024

How is this done?

from pytest-pudb.

wronglink avatar wronglink commented on June 24, 2024

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

from pytest-pudb.

massich avatar massich commented on June 24, 2024

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)

from pytest-pudb.

wronglink avatar wronglink commented on June 24, 2024

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.

from pytest-pudb.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.