MCPcopy
hub / github.com/mne-tools/mne-python / test_frame_info

Function test_frame_info

mne/utils/tests/test_logging.py:43–63  ·  view source on GitHub ↗

Test _frame_info.

(capsys, monkeypatch)

Source from the content-addressed store, hash-verified

41
42
43def 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
66def test_how_to_deal_with_warnings():

Callers

nothing calls this directly

Calls 3

_frame_infoFunction · 0.90
use_log_levelClass · 0.90
_funFunction · 0.70

Tested by

no test coverage detected