Get more granular with Python warnings in tests