Complete the code to import the module used for generating test reports in pytest.
import [1]
The pytest_html module is used to generate HTML test reports in pytest, which is commonly integrated in CI pipelines.
Complete the pytest command to generate an HTML report named 'report.html'.
pytest --html=[1]The --html=report.html option tells pytest to create an HTML report file named 'report.html'.
Fix the error in the pytest fixture that adds environment info to the HTML report.
@pytest.hookimpl(optionalhook=True) def pytest_configure(config): config._metadata[[1]] = 'Chrome 114'
The key must be a string with quotes, like 'Browser', to correctly add metadata to the report.
Fill both blanks to add a custom environment info and remove default metadata in pytest HTML report.
def pytest_configure(config): config._metadata.pop([1], None) config._metadata[[2]] = 'QA Team'
Removing 'JAVA_HOME' cleans default metadata. Adding 'Tester' key adds custom info.
Fill all three blanks to configure pytest to generate an HTML report, save logs, and set verbosity.
pytest.main(['--html=[1]', '--self-contained-html', '--log-file=[2]', '-[3]'])
Use report.html for the HTML report file, test.log for the log file, and -v for verbose output.