Backport 1.8 3720

Backport #3720,  `MAINT: Refactor test_xerbla to hide printed error messages`.