Reset global options object in the tests

This commit is contained in:
Kovid Goyal 2022-06-07 10:58:03 +05:30
parent ad128a3c29
commit 061a0c8cb6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 9 additions and 0 deletions

View File

@ -157,6 +157,9 @@ class BaseTest(TestCase):
maxDiff = 2048
is_ci = os.environ.get('CI') == 'true'
def tearDown(self):
set_options(None)
def set_options(self, options=None):
final_options = {'scrollback_pager_history_size': 1024, 'click_interval': 0.5}
if options:

View File

@ -62,6 +62,7 @@ def serialized_cmd(**fields) -> str:
class TestFileTransmission(BaseTest):
def setUp(self):
super().setUp()
self.tdir = os.path.realpath(tempfile.mkdtemp())
self.responses = []
self.orig_home = os.environ.get('HOME')
@ -73,6 +74,7 @@ class TestFileTransmission(BaseTest):
os.environ.pop('HOME', None)
else:
os.environ['HOME'] = self.orig_home
super().tearDown()
def clean_tdir(self):
shutil.rmtree(self.tdir)

View File

@ -24,6 +24,7 @@ from . import BaseTest
class Rendering(BaseTest):
def setUp(self):
super().setUp()
self.test_ctx = setup_for_testing()
self.test_ctx.__enter__()
self.sprites, self.cell_width, self.cell_height = self.test_ctx.__enter__()
@ -39,6 +40,7 @@ class Rendering(BaseTest):
self.test_ctx.__exit__()
del self.sprites, self.cell_width, self.cell_height, self.test_ctx
shutil.rmtree(self.tdir)
super().tearDown()
def test_sprite_map(self):
sprite_map_set_limits(10, 2)

View File

@ -11,11 +11,13 @@ from kitty.fast_data_types import Color
class TestConfParsing(BaseTest):
def setUp(self):
super().setUp()
self.error_messages = []
log_error.redirect = self.error_messages.append
def tearDown(self):
del log_error.redirect
super().tearDown()
def test_conf_parsing(self):
from kitty.config import load_config, defaults