Test _frame_info.
(capsys, monkeypatch)
| 41 | |
| 42 | |
| 43 | def test_frame_info(capsys, monkeypatch): |
| 44 | """Test _frame_info.""" |
| 45 | stack = _frame_info(100) |
| 46 | assert 2 < len(stack) < 100 |
| 47 | this, pytest_line = stack[:2] |
| 48 | assert re.match("^test_logging:[1-9][0-9]$", this) is not None, this |
| 49 | assert "pytest" in pytest_line |
| 50 | capsys.readouterr() |
| 51 | with use_log_level("debug", add_frames=4): |
| 52 | _fun() |
| 53 | out, _ = capsys.readouterr() |
| 54 | out = out.replace("\n", " ") |
| 55 | assert ( |
| 56 | re.match( |
| 57 | ".*pytest.*test_logging:[2-9][0-9] .*test_logging:[1-9][0-9] :.*Test", |
| 58 | out, |
| 59 | ) |
| 60 | is not None |
| 61 | ), this |
| 62 | monkeypatch.setattr("inspect.currentframe", lambda: None) |
| 63 | assert _frame_info(1) == ["unknown"] |
| 64 | |
| 65 | |
| 66 | def test_how_to_deal_with_warnings(): |
nothing calls this directly
no test coverage detected