fix for Pytest 8 compat (#17066)
In Debian, we upgraded to pytest version 8.1.1+ for the next release.
pytest deprecated the name for the first positional argument to
`pytest.fail` from `msg` to `reason` in Pytest 7.0 and removed `msg` in
Pytest 8.0
https://docs.pytest.org/en/7.0.x/reference/reference.html#pytest-fail
https://docs.pytest.org/en/8.0.x/changelog.html#old-deprecations-are-now-errors