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: