From 714861900c35b9d2cabfa16233ee1fcd3791650c Mon Sep 17 00:00:00 2001 From: eskerda Date: Mon, 12 Jun 2023 16:41:23 +0200 Subject: [PATCH] Get pytest metadata from stash object (fix #89) --- pytest_jsonreport/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest_jsonreport/plugin.py b/pytest_jsonreport/plugin.py index 6ee4ea5..f768d69 100644 --- a/pytest_jsonreport/plugin.py +++ b/pytest_jsonreport/plugin.py @@ -7,6 +7,7 @@ import time import warnings +from pytest_metadata.plugin import metadata_key import pytest import _pytest.hookspec @@ -228,7 +229,7 @@ def pytest_sessionfinish(self, session): duration=time.time() - self._start_time, exitcode=session.exitstatus, root=str(session.fspath), - environment=getattr(self._config, '_metadata', {}), + environment=self._config.stash.get(metadata_key, {}), summary=serialize.make_summary(self._json_tests, **summary_data), ) if not self._config.option.json_report_summary: