Fix coverage uploading with codecov-action@v2 (#391)
Fix coverage uploading with codecov-action@v2 (#391)

The codecov-action@v2 does not automatically generate the XML coverage
report (unlike v1), so we need to generate it ourselves by running:

  coverage xml

This generates a `coverage.xml` file from the binary `.coverage` file
written by pytest. We will now also fail the CI if the codecov upload
fails, to help catch issues like this more easily.

Note that we could have added `--cov-report=xml` to the pytest options
in `setup.cfg`, but the XML coverage file is not generally useful to
devs running pytest locally. We also could have added it to the pytest
invocation in the test workflow, but we would have needed to repeat it
twice due to the pypy-specific step.
MechanicalSoup/MechanicalSoup