Skip to content

Commit b4f92d8

Browse files
committed
feat: do not store the profile when CODPSEED_PROFILE_FOLDER is not set
1 parent e8498e4 commit b4f92d8

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/pytest_codspeed/plugin.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import random
88
from dataclasses import dataclass, field
99
from pathlib import Path
10-
from time import time
1110
from typing import TYPE_CHECKING, cast
1211

1312
import pytest
@@ -297,12 +296,9 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus):
297296
plugin = get_plugin(session.config)
298297
if plugin.is_codspeed_enabled:
299298
plugin.instrument.report(session)
300-
if plugin.profile_folder:
301-
result_path = plugin.profile_folder / "results" / f"{os.getpid()}.json"
302-
else:
303-
result_path = (
304-
session.config.rootpath / f".codspeed/results_{time() * 1000:.0f}.json"
305-
)
299+
if plugin.profile_folder is None:
300+
return
301+
result_path = plugin.profile_folder / "results" / f"{os.getpid()}.json"
306302
data = {**get_environment_metadata(), **plugin.instrument.get_result_dict()}
307303
result_path.parent.mkdir(parents=True, exist_ok=True)
308304
result_path.write_text(json.dumps(data, indent=2))

0 commit comments

Comments
 (0)