Skip to content

Commit 2e8a7a8

Browse files
committed
fix(valgrind): throw error when instrument hooks failed to initialize under codspeed env
1 parent bf30b24 commit 2e8a7a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pytest_codspeed/instruments/valgrind.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
import warnings
45
from typing import TYPE_CHECKING
56

@@ -27,7 +28,11 @@ def __init__(self, config: CodSpeedConfig) -> None:
2728
try:
2829
self.instrument_hooks = InstrumentHooks()
2930
self.instrument_hooks.set_integration("pytest-codspeed", __semver_version__)
30-
except RuntimeError:
31+
except RuntimeError as e:
32+
if os.environ.get("CODSPEED_ENV") is not None:
33+
raise Exception(
34+
"Failed to initialize CPU simulation instrument hooks"
35+
) from e
3136
self.instrument_hooks = None
3237

3338
self.should_measure = self.instrument_hooks is not None

0 commit comments

Comments
 (0)