From 768b5b83644b53d8fd7d4a21946033ea2e86d110 Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Thu, 3 Oct 2024 17:48:21 +0200 Subject: [PATCH] feat: fix the random seed while measuring with instruments --- src/pytest_codspeed/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index 881b27d..17374f2 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -5,6 +5,7 @@ import importlib.util import json import os +import random from dataclasses import dataclass, field from pathlib import Path from time import time @@ -259,6 +260,7 @@ def _measure( *args: P.args, **kwargs: P.kwargs, ) -> T: + random.seed(0) is_gc_enabled = gc.isenabled() if is_gc_enabled: gc.collect()