Skip to content

Commit

Permalink
allow pdbcls without implying usepdb
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszotten committed Sep 19, 2016
1 parent 8639bf7 commit 425c5f0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions _pytest/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ def pytest_namespace():
return {'set_trace': pytestPDB().set_trace}

def pytest_configure(config):
if config.getvalue("usepdb") or config.getvalue("usepdb_cls"):
if config.getvalue("usepdb_cls"):
modname, classname = config.getvalue("usepdb_cls").split(":")
__import__(modname)
pdb_cls = getattr(sys.modules[modname], classname)
else:
pdb_cls = pdb.Pdb

if config.getvalue("usepdb"):
config.pluginmanager.register(PdbInvoke(), 'pdbinvoke')
if config.getvalue("usepdb_cls"):
modname, classname = config.getvalue("usepdb_cls").split(":")
__import__(modname)
pdb_cls = getattr(sys.modules[modname], classname)
else:
pdb_cls = pdb.Pdb
pytestPDB._pdb_cls = pdb_cls

old = (pdb.set_trace, pytestPDB._pluginmanager)
def fin():
Expand All @@ -38,6 +38,7 @@ def fin():
pdb.set_trace = pytest.set_trace
pytestPDB._pluginmanager = config.pluginmanager
pytestPDB._config = config
pytestPDB._pdb_cls = pdb_cls
config._cleanup.append(fin)

class pytestPDB:
Expand Down

0 comments on commit 425c5f0

Please sign in to comment.