Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Chore: Support legacy pytest-metadata
  • Loading branch information
BeyondEvil committed Aug 13, 2023
commit 5a4dea131ac78ee1dcad17f6e5d49561cdb157ba
14 changes: 12 additions & 2 deletions src/pytest_html/basereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pathlib import Path

import pytest
from pytest_metadata.plugin import metadata_key

from pytest_html import __version__
from pytest_html import extras
Expand Down Expand Up @@ -66,7 +65,18 @@ def _generate_report(self, self_contained=False):
self._write_report(rendered_report)

def _generate_environment(self):
metadata = self._config.stash[metadata_key]
try:
from pytest_metadata.plugin import metadata_key

metadata = self._config.stash[metadata_key]
except ImportError:
# old version of pytest-metadata
metadata = self._config._metadata
warnings.warn(
"'pytest-metadata < 3.0.0' is deprecated and support will be dropped in next major version",
DeprecationWarning,
)

for key in metadata.keys():
value = metadata[key]
if self._is_redactable_environment_variable(key):
Expand Down