Local and remote debugging of avocado tests #5852
pevogam
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, I guess you might already be aware of that but I recently checked for a way to debug python tests run via Avocado (which can still be useful for some more complex settings where isolation tests are not sufficiently precise at the time and so on). I ended up using
debugpy
which is a great tool implementing the Debug Adapter Protocol for Python like so(give or take some SSH port forwarding since the python unit tests actually run inside a container) but interestingly could only stop at a breakpoint if I add it manually inside the python code of the unit test:
which is done only in code and the invocation remains a regular avocado test running invocation without involving
debugpy
. This prompted me to investigate the logs (dumped in.
due to the extra setting above) and find out that the break point request was sent just fine if I used VS code as a client front endwith a success status followed by information on various spawned processes but specifically for the unit test subprocess:
This informed me that the python unit tests are run as INSTRUMENTED tests and it seems these are not easily recognized as python processes so the debugging could also be injected inside those subprocesses. I then confirmed this is the case by running the unit test via regular python invocation:
which stopped at all requested break points and performed just fine. So all in all I wanted to see what is your opinion about supporting debugging in Avocado, especially debugging via such a flexible protocol? Perhaps there is some simple change we can do so that the subprocesses for the unit tests are recognized as python processes and such debugging might become fully possible? Or do you suggest another way to debug code via the unit/isolation tests or perhaps believe that debugging should only be possible with integration tests?
Beta Was this translation helpful? Give feedback.
All reactions