Skip to content

Commit a565443

Browse files
committed
Saner tempdir removal
1 parent 081d6a3 commit a565443

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kitty_tests/shell_integration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import os
66
import shutil
7+
import tempfile
78
import unittest
89
from contextlib import contextmanager
9-
from tempfile import TemporaryDirectory
1010

1111
from kitty.constants import terminfo_dir
1212
from kitty.fast_data_types import CURSOR_BEAM
@@ -37,13 +37,17 @@ class ShellIntegration(BaseTest):
3737

3838
@contextmanager
3939
def run_shell(self, shell='zsh', rc=''):
40-
with TemporaryDirectory() as home_dir:
40+
home_dir = os.path.realpath(tempfile.mkdtemp())
41+
try:
4142
pty = self.create_pty(f'{shell} -il', cwd=home_dir, env=safe_env_for_running_shell(home_dir, rc))
4243
i = 10
4344
while i > 0 and not pty.screen_contents().strip():
4445
pty.process_input_from_child()
4546
i -= 1
4647
yield pty
48+
finally:
49+
if os.path.exists(home_dir):
50+
shutil.rmtree(home_dir)
4751

4852
@unittest.skipUnless(shutil.which('zsh'), 'zsh not installed')
4953
def test_zsh_integration(self):

0 commit comments

Comments
 (0)