Run all tests on the full frozen build using the frozen launcher

Much more comprehensive test coverage at the cost of slightly increasing
the frozen build size.
This commit is contained in:
Kovid Goyal
2021-02-19 17:57:59 +05:30
parent e06d40cb31
commit c2a924a5ea
8 changed files with 51 additions and 79 deletions

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import os
import unittest
class TestBuild(unittest.TestCase):
def test_exe(self) -> None:
from kitty.constants import kitty_exe
exe = kitty_exe()
self.assertTrue(os.access(exe, os.X_OK))
self.assertTrue(os.path.isfile(exe))
self.assertIn('kitty', os.path.basename(exe))
def test_loading_extensions(self) -> None:
import kitty.fast_data_types as fdt
from kittens.unicode_input import unicode_names
from kittens.choose import subseq_matcher
from kittens.diff import diff_speedup
del fdt, unicode_names, subseq_matcher, diff_speedup
def test_loading_shaders(self) -> None:
from kitty.utils import load_shaders
for name in 'cell border bgimage tint blit graphics'.split():
load_shaders(name)
def test_glfw_modules(self) -> None:
from kitty.constants import is_macos, glfw_path
modules = ('cocoa',) if is_macos else ('x11', 'wayland')
for name in modules:
path = glfw_path(name)
self.assertTrue(os.path.isfile(path))
self.assertTrue(os.access(path, os.X_OK))
def test_all_kitten_names(self) -> None:
from kittens.runner import all_kitten_names
names = all_kitten_names()
self.assertIn('diff', names)
self.assertIn('hints', names)
self.assertGreater(len(names), 8)
def test_filesystem_locations(self) -> None:
from kitty.constants import terminfo_dir, logo_png_file
self.assertTrue(os.path.isdir(terminfo_dir), f'Terminfo dir: {terminfo_dir}')
self.assertTrue(os.path.exists(logo_png_file), f'Logo file: {logo_png_file}')
def main() -> None:
tests = unittest.defaultTestLoader.loadTestsFromTestCase(TestBuild)
r = unittest.TextTestRunner(verbosity=4)
result = r.run(tests)
if result.errors or result.failures:
raise SystemExit(1)

View File

@@ -89,7 +89,7 @@ class Rendering(BaseTest):
return font_path_cache[name]
def ss(text, font=None):
path = f'kitty_tests/{font}' if font else None
path = path_for_font(font) if font else None
return shape_string(text, path=path)
def groups(text, font=None):

View File

@@ -23,12 +23,13 @@ def itertests(suite: unittest.TestSuite) -> Generator[unittest.TestCase, None, N
yield test
def find_all_tests(package: str = '', excludes: Sequence[str] = ('main.py', 'gr.py')) -> unittest.TestSuite:
def find_all_tests(package: str = '', excludes: Sequence[str] = ('main', 'gr')) -> unittest.TestSuite:
suits = []
if not package:
package = __name__.rpartition('.')[0] if '.' in __name__ else 'kitty_tests'
for x in contents(package):
if x.endswith('.py') and x not in excludes:
name, ext = os.path.splitext(x)
if ext in ('.py', '.pyc') and name not in excludes:
m = importlib.import_module(package + '.' + x.partition('.')[0])
suits.append(unittest.defaultTestLoader.loadTestsFromModule(m))
return unittest.TestSuite(suits)