Make deleting test dir suring shell integration tests robust against fish 4 background daemon generating completions

This commit is contained in:
Kovid Goyal
2025-03-08 10:41:11 +05:30
parent 54e1f639a8
commit 8cbdd003e2

View File

@@ -2,6 +2,7 @@
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import errno
import os
import shlex
import shutil
@@ -101,8 +102,15 @@ class ShellIntegration(BaseTest):
i -= 1
yield pty
finally:
if os.path.exists(home_dir):
shutil.rmtree(home_dir)
while os.path.exists(home_dir):
try:
shutil.rmtree(home_dir)
except OSError as e:
# As of fish 4 fish runs a background daemon generating
# completions.
if e.errno == errno.ENOTEMPTY:
continue
raise
@unittest.skipUnless(shutil.which('zsh'), 'zsh not installed')
def test_zsh_integration(self):