I was wondering if I can skip test during it's execution using KeyboardInterrupt.
I saw that pytest got the hook function:
def pytest_keyboard_interrupt(excinfo)
which is great, but after it's running, it stops the execution of all the tests, and I want only to skip the specific test that the KeyboardInterrupt came from.
EDIT: I was trying to call pytest from another file and catching KeyboardInterrupt like that:
import pytest
try:
pytest.main(["begin.py", "-vs", "--pdb"])
except KeyboardInterrupt:
pytest.skip("Skipped")
But it doesn't work.
I will appreciate any help :)