@@ -96,7 +96,7 @@ class CodSpeedPlugin:
9696 instrument : Instrument
9797 config : CodSpeedConfig
9898 disabled_plugins : tuple [str , ...]
99- result_path : Path | None
99+ profile_folder : Path | None
100100 benchmark_count : int = field (default = 0 , hash = False , compare = False )
101101
102102
@@ -143,10 +143,6 @@ def pytest_configure(config: pytest.Config):
143143 disabled_plugins .append ("pytest-speed" )
144144
145145 profile_folder = os .environ .get ("CODSPEED_PROFILE_FOLDER" )
146- if profile_folder :
147- result_path = Path (profile_folder ) / "results" / f"{ os .getpid ()} .json"
148- else :
149- result_path = config .rootpath / f".codspeed/results_{ time () * 1000 :.0f} .json"
150146
151147 codspeedconfig = CodSpeedConfig .from_pytest_config (config )
152148
@@ -156,7 +152,7 @@ def pytest_configure(config: pytest.Config):
156152 mode = mode ,
157153 instrument = instrument (codspeedconfig ),
158154 config = codspeedconfig ,
159- result_path = result_path ,
155+ profile_folder = Path ( profile_folder ) if profile_folder else None ,
160156 )
161157 config .pluginmanager .register (plugin , PLUGIN_NAME )
162158
@@ -297,10 +293,15 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus):
297293 plugin = get_plugin (session .config )
298294 if plugin .is_codspeed_enabled :
299295 plugin .instrument .report (session )
300- if plugin .result_path is not None :
301- data = {** get_environment_metadata (), ** plugin .instrument .get_result_dict ()}
302- plugin .result_path .parent .mkdir (parents = True , exist_ok = True )
303- plugin .result_path .write_text (json .dumps (data , indent = 2 ))
296+ if plugin .profile_folder :
297+ result_path = plugin .profile_folder / "results" / f"{ os .getpid ()} .json"
298+ else :
299+ result_path = (
300+ session .config .rootpath / f".codspeed/results_{ time () * 1000 :.0f} .json"
301+ )
302+ data = {** get_environment_metadata (), ** plugin .instrument .get_result_dict ()}
303+ result_path .parent .mkdir (parents = True , exist_ok = True )
304+ result_path .write_text (json .dumps (data , indent = 2 ))
304305
305306
306307class BenchmarkFixture :
0 commit comments