[pytest-dev] Disabling timeout for pdb
holger krekel
holger at merlinux.eu
Mon Sep 15 09:13:02 CEST 2014
Hi Wolfgang,
On Mon, Sep 15, 2014 at 08:19 +0200, Wolfgang Schnerring wrote:
> Hi,
>
> 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.
Sure, don't hesitate to ask back any questions. FYI _pytest/hookspec.py
defines hooks and pluginmanager.hook.pytest_*() is how to call them when
you have a pluginmanager reference (config.hook and item.ihook also
allow to call hooks as a shortcut).
cheers,
holger
> Wolfgang
>
> _______________________________________________
> Pytest-dev mailing list
> Pytest-dev at python.org
> https://mail.python.org/mailman/listinfo/pytest-dev
>
More information about the Pytest-dev
mailing list