How to capture warnings - pytest documentation