To create an HTML report for pytest, you can use the pytest-html plugin. First, you need to install the plugin by running the command pip install pytest-html. Once the plugin is installed, you can generate an HTML report by running pytest with the --html=path/to/report.html flag. This will create an HTML report with detailed information about the test runs including test results, duration, and any failures or errors encountered.