Skip to content

Commit f3f9f7b

Browse files
committed
Add check if valgrind is installed
1 parent f188756 commit f3f9f7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import shlex
2222
from pathlib import Path
2323
from random import shuffle
24+
import shutil
2425

2526
import pytest
2627

@@ -308,3 +309,12 @@ def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
308309

309310
test_ids = [" ".join(test_case) for test_case in test_cases]
310311
metafunc.parametrize("test_id", test_ids)
312+
313+
314+
def pytest_configure(config: pytest.Config) -> None:
315+
"""
316+
See https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.hookspec.pytest_configure
317+
"""
318+
if config.getoption("valgrind"):
319+
if shutil.which("valgrind") is None:
320+
raise RuntimeError("Passed --valgrind, but valgrind could not be found.")

0 commit comments

Comments
 (0)