Why does adding metadata in pytest_configure cause AttributeError: 'Config' object has no attribute 'metadata'?

I’m trying to add environment metadata to my pytest HTML report using pytest_configure, but accessing config.metadata throws an AttributeError.

How can I properly add metadata in pytest-html without causing this error?