diff --git a/tests/test_core_perf.py b/tests/test_core_perf.py index 143223b39..7d7f59df2 100644 --- a/tests/test_core_perf.py +++ b/tests/test_core_perf.py @@ -1,10 +1,17 @@ import time -import codecarbon.core.perf +import codecarbon.core.cpu + +try: + from codecarbon.core.perf import Perf +except ImportError: + Perf = None def test_perf(): - x = codecarbon.core.perf.Perf(["energy-pkg"]) + if codecarbon.core.cpu.is_perf_available() == False: + return + x = Perf(["energy-pkg"]) x.start() time.sleep(20) x.delta(20.0)