vincent
(Vincent Bastos)
September 12, 2018, 2:40am
1
Is it possible to debug unit tests and scenario tests using pdb and stepping through lines of code and checking variable values?
I know it is possible to run python -m pdb myscript.py on a particular script but is it possible to do this on python setup.py test?
1 Like
pokoli
(Sergi Almacellas Abellana)
September 12, 2018, 8:32am
2
I normally include the lines:
import pdb; pdb.set_trace()
On the source code line where I want to start the debugger.
Then running the test with the normal parameter will launch the debugger when the line is reached.
P.S: If you are on python3.7 you can use the new breakpoint function .
2 Likes
dabada83
(Diego Abad)
September 12, 2018, 3:33pm
3
On unit test I also use pdb.
Can I use pdb to debug scenarios (rst files)?
pokoli
(Sergi Almacellas Abellana)
September 13, 2018, 10:55am
4
Yes, youe just have to include the same line on the test scenario:
import pdb; pdb.set_trace()
If you include on the source code the debugger will be also openend when running the test scenario.