Skip to content

Commit f8d161c

Browse files
committed
Add term_handler
1 parent 45923f2 commit f8d161c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

testsuite/tests/conftest.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Root conftest"""
2+
import signal
3+
24
from urllib.parse import urlparse
35

46
import pytest
@@ -11,6 +13,17 @@
1113
from testsuite.utils import randomize, _whoami
1214

1315

16+
@pytest.fixture(scope='session', autouse=True)
17+
def term_handler():
18+
"""
19+
This will handle ^C, cleanup won't be skipped
20+
https://github.com/pytest-dev/pytest/issues/9142
21+
"""
22+
orig = signal.signal(signal.SIGTERM, signal.getsignal(signal.SIGINT))
23+
yield
24+
signal.signal(signal.SIGTERM, orig)
25+
26+
1427
@pytest.fixture(scope="session")
1528
def testconfig():
1629
"""Testsuite settings"""

0 commit comments

Comments
 (0)