@@ -96,7 +96,7 @@ class CodSpeedPlugin:
96
96
instrument : Instrument
97
97
config : CodSpeedConfig
98
98
disabled_plugins : tuple [str , ...]
99
- result_path : Path | None
99
+ profile_folder : Path | None
100
100
benchmark_count : int = field (default = 0 , hash = False , compare = False )
101
101
102
102
@@ -143,10 +143,6 @@ def pytest_configure(config: pytest.Config):
143
143
disabled_plugins .append ("pytest-speed" )
144
144
145
145
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"
150
146
151
147
codspeedconfig = CodSpeedConfig .from_pytest_config (config )
152
148
@@ -156,7 +152,7 @@ def pytest_configure(config: pytest.Config):
156
152
mode = mode ,
157
153
instrument = instrument (codspeedconfig ),
158
154
config = codspeedconfig ,
159
- result_path = result_path ,
155
+ profile_folder = Path ( profile_folder ) if profile_folder else None ,
160
156
)
161
157
config .pluginmanager .register (plugin , PLUGIN_NAME )
162
158
@@ -297,10 +293,15 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus):
297
293
plugin = get_plugin (session .config )
298
294
if plugin .is_codspeed_enabled :
299
295
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 ))
304
305
305
306
306
307
class BenchmarkFixture :
0 commit comments