[pytest-dev] Disabling timeout for pdb
ws at gocept.com
Mon Sep 15 08:19:50 CEST 2014
thanks for your feedback!
* Bruno Oliveira [2014-09-13 15:53]:
> > 1. Am I missing something or does pytest indeed completely seal off its internals?
> Not really, you can access _pytest module directly:
> >>> import _pytest.pdb
> >>> _pytest.pdb.pytestPDB
> <class _pytest.pdb.pytestPDB at 0x026F0500>
Right. Trust me to miss the absolutely obvious way of doing it. ;)
So, using this, I guess I could implement the feature from within the
pytest_timeout plugin, by subclassing pytestPDB and overriding the
"pytest.set_trace" binding by providing a pytest_namespace() that points to the
subclassed version. And then I'd probably have to re-monkeypatch
"pdb.set_trace" while I'm at it, or else that will still point to the pytestPDB
instance set up by core pytest. Wellll. Doable, but ugly, so...
* holger krekel [2014-09-14 15:00]:
> What we probabl need is a new hook, "pytest_enter_pdb" maybe, which
> pytest-timeout can implement to switch off timeout handling.
> pytest would call this hook in the "pdb.set_trace()" interception
> code around _pytest/pdb.py:34.
... an explicit hook like this would probably be better.
If that's alright with you I could give this a try. That'll necessitate changes
in both pytest and pytest_timeout, but I do think it's the cleaner solution.
More information about the Pytest-dev