File: pytest_check_failed_plugin_test.py

package info (click to toggle)
python-pyfakefs 5.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,476 kB
  • sloc: python: 20,153; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 659 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Tests that a failed pytest properly displays the call stack.
Uses the output from running pytest with pytest_plugin_failing_helper.py.
Regression test for #381.
"""

import os

import pytest


@pytest.mark.skipif(not os.path.exists("testresult.txt"), reason="Only run in CI tests")
def test_failed_testresult_stacktrace():
    with open("testresult.txt") as f:
        contents = f.read()
    # before the fix, a triple question mark has been displayed
    # instead of the stacktrace
    assert contents
    print("contents", contents)
    assert "???" not in contents
    assert "AttributeError" not in contents
    assert "def test_fs(fs):" in contents