How to use the pdbpp.local.GLOBAL_PDB function in pdbpp

To help you get started, we’ve selected a few pdbpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def fn():
        set_trace()
        first = pdbpp.local.GLOBAL_PDB
        assert isinstance(pdbpp.local.GLOBAL_PDB, PdbTest)

        class PdbLikePytest(object):
            @classmethod
            def init_pdb(cls):

                class NewPdb(PdbTest, pdbpp.Pdb):
                    def set_trace(self, frame):
                        print("new_set_trace")
                        super(NewPdb, self).set_trace(frame)

                return NewPdb()

            @classmethod
            def set_trace(cls, *args, **kwargs):
                frame = sys._getframe().f_back
                pdb_ = cls.init_pdb(*args, **kwargs)
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def fn():
        set_trace()
        first = pdbpp.local.GLOBAL_PDB

        set_trace(cleanup=False)
        assert first is pdbpp.local.GLOBAL_PDB

        monkeypatch.setenv("HOME", "something else")
        set_trace(cleanup=False)
        assert first is not pdbpp.local.GLOBAL_PDB
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def check_completions():
            # Patch readline to return expected results for "help".
            monkeypatch_readline("help", 0, 4)

            if readline_param == "pyrepl":
                assert pdbpp.local.GLOBAL_PDB.fancycompleter.config.use_colors is True
                assert get_completions("help") == [
                    "\x1b[000;00m\x1b[00mhelp\x1b[00m",
                    "\x1b[001;00m\x1b[33;01mhelpvar\x1b[00m",
                    " ",
                ]
            else:
                assert pdbpp.local.GLOBAL_PDB.fancycompleter.config.use_colors is False
                assert get_completions("help") == ["help", "helpvar"]

            # Patch readline to return expected results for "p helpvar.".
            monkeypatch_readline("p helpvar.", 2, 10)
            if readline_param == "pyrepl":
                assert pdbpp.local.GLOBAL_PDB.fancycompleter.config.use_colors is True
                comps = get_completions("helpvar.")
                assert type(helpvar.denominator) == int
                assert any(
                    re.match(r"\x1b\[\d\d\d;00m\x1b\[33;01mdenominator\x1b\[00m", x)
                    for x in comps
                )
                assert " " in comps
            else:
                assert pdbpp.local.GLOBAL_PDB.fancycompleter.config.use_colors is False
                comps = get_completions("helpvar.")
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def fn():
        class NewPdb(PdbTest, pdbpp.Pdb):
            def set_trace(self, *args):
                print("new_set_trace")
                ret = super(NewPdb, self).set_trace(*args)
                return ret

        new_pdb = NewPdb()
        new_pdb.set_trace()
        assert pdbpp.local.GLOBAL_PDB is new_pdb

        set_trace(cleanup=False)
        assert pdbpp.local.GLOBAL_PDB is not new_pdb

        # What "debug" does, for coverage.
        new_pdb = NewPdb()
        new_pdb.set_trace()
        assert pdbpp.local.GLOBAL_PDB is new_pdb
        pdbpp.local.GLOBAL_PDB._use_global_pdb_for_class = PdbTest
        set_trace(cleanup=False)
        assert pdbpp.local.GLOBAL_PDB is new_pdb

        # Explicit kwarg for coverage.
        new_pdb = NewPdb(set_global_pdb=False)
        new_pdb.set_trace()
        assert pdbpp.local.GLOBAL_PDB is not new_pdb
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def fn():
        set_trace()
        first = pdbpp.local.GLOBAL_PDB
        assert isinstance(first, PdbTest)

        class NewPdb(PdbTest, pdbpp.Pdb):
            def set_trace(self, *args):
                print("new_set_trace")
                assert pdbpp.local.GLOBAL_PDB is not self
                ret = super(NewPdb, self).set_trace(*args)
                assert pdbpp.local.GLOBAL_PDB is not self
                return ret

        new_pdb = NewPdb(use_global_pdb=False)
        new_pdb.set_trace()
        assert pdbpp.local.GLOBAL_PDB is not new_pdb

        set_trace(cleanup=False)
        assert pdbpp.local.GLOBAL_PDB is not new_pdb
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
print("new_set_trace")
                super(NewPdb, self).set_trace(frame)

        class PdbViaClassmethod(object):
            @classmethod
            def init_pdb(cls):
                return NewPdb()

            @classmethod
            def set_trace(cls, *args, **kwargs):
                frame = sys._getframe().f_back
                pdb_ = cls.init_pdb(*args, **kwargs)
                return pdb_.set_trace(frame)

        PdbViaClassmethod.set_trace()
        second = pdbpp.local.GLOBAL_PDB
        assert first != second

        PdbViaClassmethod.set_trace()
        third = pdbpp.local.GLOBAL_PDB
        assert third == second
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def f():
            before = pdbpp.local.GLOBAL_PDB
            set_trace(cleanup=False)
            assert before is pdbpp.local.GLOBAL_PDB
        set_trace()
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
def fn():
        set_trace()
        first = pdbpp.local.GLOBAL_PDB
        assert isinstance(pdbpp.local.GLOBAL_PDB, PdbTest)

        class NewPdb(PdbTest, pdbpp.Pdb):
            def set_trace(self, frame):
                print("new_set_trace")
                super(NewPdb, self).set_trace(frame)

        class PdbViaClassmethod(object):
            @classmethod
            def init_pdb(cls):
                return NewPdb()

            @classmethod
            def set_trace(cls, *args, **kwargs):
                frame = sys._getframe().f_back
                pdb_ = cls.init_pdb(*args, **kwargs)
github pdbpp / pdbpp / testing / test_pdb.py View on Github external
            @classmethod
            def init_pdb(cls):
                return NewPdb()

            @classmethod
            def set_trace(cls, *args, **kwargs):
                frame = sys._getframe().f_back
                pdb_ = cls.init_pdb(*args, **kwargs)
                return pdb_.set_trace(frame)

        PdbViaClassmethod.set_trace()
        second = pdbpp.local.GLOBAL_PDB
        assert first != second

        PdbViaClassmethod.set_trace()
        third = pdbpp.local.GLOBAL_PDB
        assert third == second