Use proper pytest exception check

21 jobs for trusted-test-no-data-fix in 22 minutes and 12 seconds (queued for 6 seconds)