<div dir="ltr">Hi,<div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">1. Am I missing something or does pytest indeed completely seal off its </span><span style="font-family:arial,sans-serif;font-size:13px">internals?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Not really, you can access _pytest module directly:</span></div><div><div style><font face="arial, sans-serif">>>> import _pytest.pdb</font></div><div style><font face="arial, sans-serif">>>> _pytest.pdb.pytestPDB</font></div><div style><font face="arial, sans-serif"><class _pytest.pdb.pytestPDB at 0x026F0500></font></div></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">> </font><span style="font-family:arial,sans-serif;font-size:13px">2. Am I approaching this wrong? How else could I go about achieving my goal </span><span style="font-family:arial,sans-serif;font-size:13px">of disabling the timeout?</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Personally I would try to implement this in pytest-timeout instead, possibly by adding a `disable_all_timeouts()` </span><span style="font-family:arial,sans-serif;font-size:13px">API function would be called automatically when `pdb.set_trace()` is called. This also leaves room for other code to disable timeout handling if needed.</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Cheers,</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 13, 2014 at 10:50 AM, Wolfgang Schnerring <span dir="ltr"><<a href="mailto:ws@gocept.com" target="_blank">ws@gocept.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'd really love for pytest_timeout to not perform the timeout when I'm using<br>
pdb (more specifically, the "import pdb; pdb.set_trace()" statement; I'm<br>
aware that pytest_timeout learned to respect the "--pdb" command line<br>
parameter recently), because it invariably bites me and then I have to<br>
re-run the tests with "--timeout=0", which is annoying.<br>
<br>
So, this means I'd need to do /something/ (most probably set a flag) as part<br>
of the pdb.set_trace() call. I gathered that pytest already wraps the<br>
pdb.set_trace() call for its own purposes, so I guess I'd need to wrap *that*.<br>
<br>
The easiest way to achieve that wrapping would be to subclass the<br>
"pytestPDB" class (simply wrapping it with a function messes up the frames).<br>
However, pytest has this magic going on where its parts are in the "_pytest"<br>
submodule which is not a normal module but something else entirely. Which<br>
means, as far as I can tell, I cannot "import pytest._pytest.pdb", which is<br>
to say, I cannot access the pytestPDB class at all.<br>
<br>
Which leaves me with two questions:<br>
1. Am I missing something or does pytest indeed completely seal off its<br>
internals? Does that mean pytestPDB would need to grow a plugin hook (say,<br>
"pytest_pdb_interact", as a companion to "pytest_exception_interact")?<br>
2. Am I approaching this wrong? How else could I go about achieving my goal<br>
of disabling the timeout?<br>
<br>
Thanks for your help,<br>
Wolfgang<br>
<br>
_______________________________________________<br>
Pytest-dev mailing list<br>
<a href="mailto:Pytest-dev@python.org">Pytest-dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pytest-dev" target="_blank">https://mail.python.org/mailman/listinfo/pytest-dev</a><br>
</blockquote></div><br></div>