#StackBounty: #elpy Can't use pdb with elpy tests

Bounty: 50

I have a pytest I am running with:

C-c C-t

In the line I’d like to debug, I have added:

from pytest import set_trace; set_trace()

However, while my test runs, it drops the *compilation* buffer into a read only PDB session:

-*- mode: compilation; default-directory: "~/wrk/mydat/" -*-
Compilation started at Mon Mar 22 14:10:38

py.test --log-level=DEBUG /home/user/wrk/mydat/my_test.py::test_that_I_succeed
Test session starts (platform: linux, Python 3.7.3, pytest 5.4.3, pytest-sugar 0.9.4)
rootdir: /home/user/wrk/mydat, inifile: pytest.ini
plugins: asyncio-0.14.0, sugar-0.9.4
collecting ... 
>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/user/wrk/mydat/mypath/mymod.py(227)__aexit__()
-> self.engine.dispose()

The self.engine.dispose() is where I plan to debug. But when I start typing in the (Pdb) prompt, I get

'[letter] is not defined' 

for any typing I do.

The (Pdb) prompt is read-only, as far as I can tell. I suspect this is maybe caused by IO capturing turned off

Anyhow, how can I set trace and enter a pdb session from a C-c C-t "run single test" call in elpy?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.