Skip to content

Add docs and examples for the '--pdbcls' option #3141

Closed

Description

@nicoddemus

Activity

  1. added
    type: docs
    good first issue
    on Jan 22, 2018
  2. recursivelycurious commented on Feb 12, 2018

    @recursivelycurious

    @nicoddemus happy to tackle this if no one else is working on it per your comment on #2324 -- note I'm still open to implementing that if we think its worth doing.

  3. nicoddemus commented on Feb 22, 2018

    @nicoddemus
    MemberAuthor

    @recursivelycurious please go ahead, thanks!

  4. recursivelycurious commented on Feb 22, 2018

    @recursivelycurious

    @nicoddemus will do :) feel free to assign it to me if that is part of the workflow.

  5. nicoddemus commented on Feb 22, 2018

    @nicoddemus
    MemberAuthor

    Thanks, we usually do not assign, you can go ahead and open the PR when you can. 👍

  6. blueyed commented on Apr 9, 2019

    @blueyed
    Contributor

    JFI: by now attribute access also works, e.g. --pdbcls ipdb:__main__.debugger_cls.

  7. nnrepos commented on Nov 2, 2019

    @nnrepos
    Contributor

    @nicoddemus could you reference where in the code --pdbcls is implemented, or an example where it can be used? Thanks

  8. nicoddemus commented on Nov 2, 2019

    @nicoddemus
    MemberAuthor

    @nnrepos sure, here's the option is defined:

    group._addoption(
    "--pdbcls",
    dest="usepdb_cls",
    metavar="modulename:classname",
    type=_validate_usepdb_cls,
    help="start a custom interactive Python debugger on errors. "
    "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb",
    )

    And here the option (the attribute usepdb_cls) is used:

    def _import_pdb_cls(cls, capman):
    if not cls._config:
    # Happens when using pytest.set_trace outside of a test.
    return pdb.Pdb
    usepdb_cls = cls._config.getvalue("usepdb_cls")
    if cls._wrapped_pdb_cls and cls._wrapped_pdb_cls[0] == usepdb_cls:
    return cls._wrapped_pdb_cls[1]
    if usepdb_cls:
    modname, classname = usepdb_cls
    try:
    __import__(modname)
    mod = sys.modules[modname]
    # Handle --pdbcls=pdb:pdb.Pdb (useful e.g. with pdbpp).
    parts = classname.split(".")
    pdb_cls = getattr(mod, parts[0])
    for part in parts[1:]:
    pdb_cls = getattr(pdb_cls, part)
    except Exception as exc:
    value = ":".join((modname, classname))
    raise UsageError(
    "--pdbcls: could not import {!r}: {}".format(value, exc)
    )
    else:
    pdb_cls = pdb.Pdb
    wrapped_cls = cls._get_pdb_wrapper_class(pdb_cls, capman)
    cls._wrapped_pdb_cls = (usepdb_cls, wrapped_cls)
    return wrapped_cls

    Let us know if you need further pointers. 👍

  9. Leundai commented on Jun 5, 2020

    @Leundai

    Hi has this issue been finished yet at all?

  10. nicoddemus commented on Jun 5, 2020

    @nicoddemus
    MemberAuthor

    Hi @Leundai, not yet, feel free to pick it up if you are interested. 👍

  11. yasharth291 commented on Aug 19, 2020

    @yasharth291

    I will pick it up
    @nicoddemus

  12. pralkarz commented on Feb 18, 2022

    @pralkarz
    Contributor

    I did some research and it looks like the docs have been added in #7747 and #8536.
    Are we okay to close this issue now or should the docs elaborate more on the feature?

  13. nicoddemus commented on Feb 18, 2022

    @nicoddemus
    MemberAuthor

    Thanks @ziebam!

    If anything else is still missing, we can open a new issue to track that specifically. 👍

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuetype: docs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions