diff --git a/.github/workflows/ci.py b/.github/workflows/ci.py index 010738654..faf76aa34 100644 --- a/.github/workflows/ci.py +++ b/.github/workflows/ci.py @@ -44,7 +44,7 @@ def install_deps(): # needed for zlib for pillow, should not be needed after pillow 8.0 os.environ['PKG_CONFIG_PATH'] = '/usr/local/opt/zlib/lib/pkgconfig' cmd = 'pip3 install Pillow pygments' - if sys.version[:2] < (3, 7): + if sys.version_info[:2] < (3, 7): cmd += ' importlib-resources' run(cmd) diff --git a/kitty_tests/__init__.py b/kitty_tests/__init__.py index 7e8eedb2b..7aa272484 100644 --- a/kitty_tests/__init__.py +++ b/kitty_tests/__init__.py @@ -12,30 +12,30 @@ from kitty.fast_data_types import LineBuf, Cursor, Screen, HistoryBuf class Callbacks: - def __init__(self): + def __init__(self) -> None: self.clear() - def write(self, data): + def write(self, data) -> None: self.wtcbuf += data - def title_changed(self, data): + def title_changed(self, data) -> None: self.titlebuf += data - def icon_changed(self, data): + def icon_changed(self, data) -> None: self.iconbuf += data - def set_dynamic_color(self, code, data): + def set_dynamic_color(self, code, data) -> None: self.colorbuf += data or '' - def set_color_table_color(self, code, data): + def set_color_table_color(self, code, data) -> None: self.ctbuf += '' - def request_capabilities(self, q): + def request_capabilities(self, q) -> None: from kitty.terminfo import get_capabilities for c in get_capabilities(q, None): self.write(c.encode('ascii')) - def use_utf8(self, on): + def use_utf8(self, on) -> None: self.iutf8 = on def desktop_notify(self, osc_code: int, raw_data: str) -> None: @@ -44,7 +44,7 @@ class Callbacks: def open_url(self, url: str, hyperlink_id: int) -> None: self.open_urls.append((url, hyperlink_id)) - def clear(self): + def clear(self) -> None: self.wtcbuf = b'' self.iconbuf = self.titlebuf = self.colorbuf = self.ctbuf = '' self.iutf8 = True diff --git a/test.py b/test.py index 0b6552320..b4c611565 100755 --- a/test.py +++ b/test.py @@ -2,6 +2,7 @@ # vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2016, Kovid Goyal +import importlib import os import sys @@ -14,8 +15,8 @@ def init_env() -> None: def main() -> None: init_env() - from kitty_tests.main import run_tests # type: ignore - run_tests() + m = importlib.import_module('kitty_tests.main') + m.run_tests() # type: ignore if __name__ == '__main__':