Make JSON reading test a bit more robust
This commit is contained in:
parent
cb0d23bae8
commit
94551623ec
1 changed files with 6 additions and 2 deletions
|
|
@ -47,7 +47,6 @@ def report_screen_size_change(*a):
|
|||
'font_family': get_options().font_family,
|
||||
'cols': read_screen_size(fd=sys.stderr.fileno()).cols,
|
||||
'stdin_data': sys.stdin.read(),
|
||||
|
||||
'done': 'hello',
|
||||
}
|
||||
print(json.dumps(output, indent=2), file=sys.stderr, flush=True)
|
||||
|
|
@ -114,7 +113,12 @@ def wait_for_death(exit_code, timeout=5):
|
|||
stdin_data = 'testing--stdin-read'
|
||||
with open(stdin_w, 'w') as f:
|
||||
f.write(stdin_data)
|
||||
pty.wait_till(lambda: 'hello' in pty.screen_contents())
|
||||
|
||||
def has_json():
|
||||
s = pty.screen_contents().strip()
|
||||
return 'hello' in s and s.endswith('}')
|
||||
|
||||
pty.wait_till(has_json)
|
||||
wait_for_death(exit_code)
|
||||
output = json.loads(pty.screen_contents().strip())
|
||||
self.assertEqual(output['test_env'], env['TEST_ENV_PASS'])
|
||||
|
|
|
|||
Loading…
Reference in a new issue