diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 84cac3862..88e41bab5 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -34,7 +34,7 @@ def _cmp_raises_type_error(self, other): def _non_numeric_type_error(value): return TypeError( - "cannot make approximate comparisons to non-numeric values, e.g. {}".format( + "cannot make approximate comparisons to non-numeric values, e.g. {!r}".format( value ) ) @@ -507,6 +507,8 @@ def approx(expected, rel=None, abs=None, nan_ok=False): # class provides some convenient methods and overloads, but isn't really # essential. + __tracebackhide__ = True + if isinstance(expected, Decimal): cls = ApproxDecimal elif isinstance(expected, Number):