'VSCode: how to interrupt a running Python test?

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.



Solution 1:[1]

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

Test stop button

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 rioV8