mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 23:35:04 +02:00
Move printing tmux logs out of test_expected_result
This commit is contained in:
parent
883aa73e9f
commit
bbb9ae21f4
@ -38,7 +38,19 @@ def cell_properties_key_to_shell_escape(cell_properties_key):
|
|||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
def test_expected_result(p, expected_result, print_logs):
|
def print_tmux_logs():
|
||||||
|
for f in glob1(VTERM_TEST_DIR, '*.log'):
|
||||||
|
print('_' * 80)
|
||||||
|
print(f + ':')
|
||||||
|
print('=' * 80)
|
||||||
|
full_f = os.path.join(VTERM_TEST_DIR, f)
|
||||||
|
with open(full_f, 'r') as fp:
|
||||||
|
for line in fp:
|
||||||
|
sys.stdout.write(line)
|
||||||
|
os.unlink(full_f)
|
||||||
|
|
||||||
|
|
||||||
|
def test_expected_result(p, expected_result, last_attempt, last_attempt_cb):
|
||||||
expected_text, attrs = expected_result
|
expected_text, attrs = expected_result
|
||||||
attempts = 3
|
attempts = 3
|
||||||
result = None
|
result = None
|
||||||
@ -63,16 +75,8 @@ def test_expected_result(p, expected_result, print_logs):
|
|||||||
print('Diff:')
|
print('Diff:')
|
||||||
print('=' * 80)
|
print('=' * 80)
|
||||||
print(''.join((u(line) for line in ndiff([actual_text], [expected_text]))))
|
print(''.join((u(line) for line in ndiff([actual_text], [expected_text]))))
|
||||||
if print_logs:
|
if last_attempt:
|
||||||
for f in glob1(VTERM_TEST_DIR, '*.log'):
|
last_attempt_cb()
|
||||||
print('_' * 80)
|
|
||||||
print(f + ':')
|
|
||||||
print('=' * 80)
|
|
||||||
full_f = os.path.join(VTERM_TEST_DIR, f)
|
|
||||||
with open(full_f, 'r') as fp:
|
|
||||||
for line in fp:
|
|
||||||
sys.stdout.write(line)
|
|
||||||
os.unlink(full_f)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@ -308,7 +312,8 @@ def main(attempts=3):
|
|||||||
test_prep()
|
test_prep()
|
||||||
ret = (
|
ret = (
|
||||||
ret
|
ret
|
||||||
and test_expected_result(p, expected_result, attempts == 0)
|
and test_expected_result(p, expected_result, attempts == 0,
|
||||||
|
print_tmux_logs)
|
||||||
)
|
)
|
||||||
|
|
||||||
if ret or attempts == 0:
|
if ret or attempts == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user