This commit is contained in:
Kovid Goyal 2024-02-15 15:01:50 +05:30
parent 76381f5cdd
commit e7d6101bd4
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 7 deletions

View file

@ -6,6 +6,7 @@ import io
import os
import select
import shlex
import shutil
import signal
import struct
import sys
@ -179,6 +180,12 @@ class BaseTest(TestCase):
maxDiff = 2048
is_ci = os.environ.get('CI') == 'true'
def rmtree_ignoring_errors(self, tdir):
try:
shutil.rmtree(tdir)
except FileNotFoundError as err:
print('Failed to delete the directory:', tdir, 'with error:', err, file=sys.stderr)
def tearDown(self):
set_options(None)

View file

@ -7,7 +7,7 @@ import shutil
import stat
import tempfile
from collections import namedtuple
from contextlib import contextmanager, suppress
from contextlib import contextmanager
from pathlib import Path
from kittens.transfer.rsync import Differ, Hasher, Patcher, parse_ftc
@ -188,8 +188,7 @@ class TestFileTransmission(BaseTest):
self.orig_home = os.environ.get('HOME')
def tearDown(self):
with suppress(FileNotFoundError):
shutil.rmtree(self.tdir)
self.rmtree_ignoring_errors(self.tdir)
self.responses = []
if self.orig_home is None:
os.environ.pop('HOME', None)

View file

@ -2,11 +2,9 @@
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
import sys
import tempfile
import unittest
from contextlib import suppress
from functools import partial
from kitty.constants import is_macos, read_kitty_resource
@ -35,8 +33,7 @@ class Rendering(BaseTest):
def tearDown(self):
self.test_ctx.__exit__()
del self.sprites, self.cell_width, self.cell_height, self.test_ctx
with suppress(FileNotFoundError):
shutil.rmtree(self.tdir)
self.rmtree_ignoring_errors(self.tdir)
super().tearDown()
def test_sprite_map(self):