From 9d971d33bec34715715bf5c5c269bc73fca00c36 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 1 Oct 2018 18:45:08 -0300 Subject: [PATCH] Hide internal pytest.warns traceback --- src/_pytest/recwarn.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 0eee4c841..7a0586697 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -212,6 +212,8 @@ class WarningsChecker(WarningsRecorder): def __exit__(self, *exc_info): super(WarningsChecker, self).__exit__(*exc_info) + __tracebackhide__ = True + # only check if we're not currently handling an exception if all(a is None for a in exc_info): if self.expected_warning is not None: