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: diff --git a/setup.py b/setup.py index 563fc6d..a60504f 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ license='MIT', install_requires=[ 'pytest>=3.8.0', - 'pytest-metadata', + 'pytest-metadata>=3.0.0', ], entry_points={ 'pytest11': [