Dont depend on the default bash prompt when testing

This commit is contained in:
Kovid Goyal 2022-02-23 11:19:49 +05:30
parent 2dd7c3b939
commit 4279f20daf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -309,11 +309,12 @@ PS1="{ps1}"
with open(os.path.join(home_dir, x), 'w') as f:
print(f'echo {x}', file=f)
ans['KITTY_BASH_ETC_LOCATION'] = home_dir
ans['PS1'] = 'PROMPT $ '
return ans
def run_test(argv, *expected, excluded=()):
with self.subTest(argv=argv), self.run_shell(shell='bash', setup_env=partial(setup_env, set(excluded)), cmd=argv) as pty:
pty.wait_till(lambda: '$' in pty.screen_contents())
pty.wait_till(lambda: 'PROMPT $' in pty.screen_contents())
q = pty.screen_contents()
for x in expected:
self.assertIn(x, q)