Files
babi/tests/features/perf_log_test.py
Anthony Sottile ebee8fe6ff drop python 3.6
2021-09-11 15:21:27 -04:00

16 lines
496 B
Python

from __future__ import annotations
from testing.runner import and_exit
def test(run, tmpdir, ten_lines):
f = tmpdir.join('f.log')
with run(str(ten_lines), '--perf-log', str(f)) as h, and_exit(h):
h.press('Right')
h.press('Down')
lines = f.read().splitlines()
assert lines[0] == 'μs\tevent'
expected = ['startup', 'KEY_RIGHT', 'KEY_DOWN', '^X']
assert [line.split()[-1] for line in lines[1:]] == expected
assert tmpdir.join('f.log.pstats').exists()