[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-29 18:43:02 +00:00
parent 60a58a52ca
commit aff8b059a6
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
Add `--xfail-tb` flag, which turns traceback output for XFAIL results.
Add `--xfail-tb` flag, which turns traceback output for XFAIL results.
* If the `--xfail-tb` flag is not sent, tracebacks for XFAIL results are NOT shown.
* The style of traceback for XFAIL is set with `--tb`, and can be `auto|long|short|line|native|no`.
@ -10,4 +10,4 @@ Some history:
* With this change, default `-rx`/ `-ra` behavior is identical to pre-8.0 with respect to xfail tracebacks.
* With pytest 8.0, `-rx` or `-ra` would not only turn on summary reports for xfail, but also report the tracebacks for xfail results.
* This caused issues with some projects that utilize xfail, but don't want to see all of the xfail tracebacks.
* This change detaches xfail tracebacks from `-rx`, and now we turn on xfail tracebacks with `--xfail-tb`.
* This change detaches xfail tracebacks from `-rx`, and now we turn on xfail tracebacks with `--xfail-tb`.

View File

@ -2918,7 +2918,7 @@ def xfail_testfile(pytester: Pytester) -> Path:
def test_fail():
a, b = 1, 2
assert a == b
@pytest.mark.xfail
def test_xfail():
c, d = 3, 4
@ -2926,9 +2926,10 @@ def xfail_testfile(pytester: Pytester) -> Path:
"""
)
def test_xfail_tb_default(xfail_testfile, pytester: Pytester) -> None:
result = pytester.runpytest(xfail_testfile)
# test_fail, show traceback
result.stdout.fnmatch_lines(
[
@ -2947,7 +2948,7 @@ def test_xfail_tb_default(xfail_testfile, pytester: Pytester) -> None:
def test_xfail_tb_true(xfail_testfile, pytester: Pytester) -> None:
result = pytester.runpytest(xfail_testfile, "--xfail-tb")
# both test_fail and test_xfail, show traceback
result.stdout.fnmatch_lines(
[