[pytest-dev] Disabling timeout for pdb
Wolfgang Schnerring
ws at gocept.com
Sat Sep 13 15:50:31 CEST 2014
Hi,
I'd really love for pytest_timeout to not perform the timeout when I'm using
pdb (more specifically, the "import pdb; pdb.set_trace()" statement; I'm
aware that pytest_timeout learned to respect the "--pdb" command line
parameter recently), because it invariably bites me and then I have to
re-run the tests with "--timeout=0", which is annoying.
So, this means I'd need to do /something/ (most probably set a flag) as part
of the pdb.set_trace() call. I gathered that pytest already wraps the
pdb.set_trace() call for its own purposes, so I guess I'd need to wrap *that*.
The easiest way to achieve that wrapping would be to subclass the
"pytestPDB" class (simply wrapping it with a function messes up the frames).
However, pytest has this magic going on where its parts are in the "_pytest"
submodule which is not a normal module but something else entirely. Which
means, as far as I can tell, I cannot "import pytest._pytest.pdb", which is
to say, I cannot access the pytestPDB class at all.
Which leaves me with two questions:
1. Am I missing something or does pytest indeed completely seal off its
internals? Does that mean pytestPDB would need to grow a plugin hook (say,
"pytest_pdb_interact", as a companion to "pytest_exception_interact")?
2. Am I approaching this wrong? How else could I go about achieving my goal
of disabling the timeout?
Thanks for your help,
Wolfgang
More information about the Pytest-dev
mailing list