VSCode: how to interrupt a running Python test?

Viewed 355

I'm using VSCode Test Explorer to run my Python unit tests. There was a bug in my code and my tested method never finishes.

How do I interrupt my test? I can't find how to do it using the GUI. I had to close VSCode to interrupt it.

I'm using pytest framework.

2 Answers

Silly me, here is the Stop button at the top right of the the Testing tab:

Test stop button

most test runners have a max-running-time setting

if a test takes longer it will be aborted and flagged as failed

From the pytest doc pages:

Create a file: pytest.ini

[pytest]
faulthandler_timeout=5
Related