From c44862c3cee9deb6da92e58ee140d2cffa2dc0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= Date: Tue, 23 Apr 2024 01:27:46 +0200 Subject: [PATCH] Hide `SubTests.test()` from tracebacks (#131) --- CHANGELOG.rst | 7 +++++++ src/pytest_subtests/plugin.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 61508c4..3fc9367 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ CHANGELOG ========= +UNRELEASED +---------- + +* Hide the traceback inside the ``SubTests.test()`` method (`#131`_). + +.. _#131: https://github.com/pytest-dev/pytest-subtests/pull/131 + 0.12.1 (2024-03-07) ------------------- diff --git a/src/pytest_subtests/plugin.py b/src/pytest_subtests/plugin.py index a498456..81ad5c1 100644 --- a/src/pytest_subtests/plugin.py +++ b/src/pytest_subtests/plugin.py @@ -224,6 +224,9 @@ def test( msg: str | None = None, **kwargs: Any, ) -> Generator[None, None, None]: + # Hide from tracebacks. + __tracebackhide__ = True + start = time.time() precise_start = time.perf_counter() exc_info = None