diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index c17c779..ca0db18 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -310,7 +310,10 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus): session.config.rootpath / f".codspeed/results_{time() * 1000:.0f}.json" ) data = {**get_environment_metadata(), **plugin.instrument.get_result_dict()} + created = not result_path.parent.exists() result_path.parent.mkdir(parents=True, exist_ok=True) + if created: + (result_path.parent / ".gitignore").write_text("*\n") result_path.write_text(json.dumps(data, indent=2))