diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index 78e51d8c1..59ef04f1f 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -161,7 +161,7 @@ def _git_str() -> typing.Optional[str]: return None -def _call_git(gitpath: str, *args: str): +def _call_git(gitpath: str, *args: str) -> str: """Call a git subprocess.""" return subprocess.run( ['git'] + list(args), @@ -187,7 +187,7 @@ def _git_str_subprocess(gitpath: str) -> typing.Optional[str]: date = _call_git(gitpath, 'show', '-s', '--format=%ci', 'HEAD') branch = _call_git(gitpath, 'rev-parse', '--abbrev-ref', 'HEAD') return '{} on {} ({})'.format(commit_hash, branch, date) - except (subprocess.CalledProcessError, OSError) as e: + except (subprocess.CalledProcessError, OSError): return None diff --git a/scripts/setupcommon.py b/scripts/setupcommon.py index 54a162941..65e2a498a 100644 --- a/scripts/setupcommon.py +++ b/scripts/setupcommon.py @@ -38,7 +38,7 @@ BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.pardir) -def _call_git(gitpath: str, *args: str): +def _call_git(gitpath, *args): """Call a git subprocess.""" return subprocess.run( ['git'] + list(args), diff --git a/tests/unit/keyinput/test_modeman.py b/tests/unit/keyinput/test_modeman.py index 2954d81ac..b473294f8 100644 --- a/tests/unit/keyinput/test_modeman.py +++ b/tests/unit/keyinput/test_modeman.py @@ -29,6 +29,7 @@ class FakeKeyparser(QObject): """A fake BaseKeyParser which doesn't handle anything.""" + keystring_updated = pyqtSignal(str) request_leave = pyqtSignal(usertypes.KeyMode, str, bool) def __init__(self): diff --git a/tests/unit/misc/test_keyhints.py b/tests/unit/misc/test_keyhints.py index 2e9ea1aaf..a9f8ed311 100644 --- a/tests/unit/misc/test_keyhints.py +++ b/tests/unit/misc/test_keyhints.py @@ -21,6 +21,7 @@ import pytest +from qutebrowser.utils import usertypes from qutebrowser.misc import objects from qutebrowser.misc.keyhintwidget import KeyHintView @@ -57,7 +58,7 @@ def test_show_and_hide(qtbot, keyhint): with qtbot.waitSignal(keyhint.update_geometry): with qtbot.waitExposed(keyhint): keyhint.show() - keyhint.update_keyhint('normal', '') + keyhint.update_keyhint(usertypes.KeyMode.normal, '') assert not keyhint.isVisible() @@ -84,7 +85,7 @@ def test_suggestions(keyhint, config_stub): config_stub.val.bindings.default = default_bindings config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', 'a') + keyhint.update_keyhint(usertypes.KeyMode.normal, 'a') assert keyhint.text() == expected_text( ('a', 'yellow', 'a', 'message-info cmd-aa'), ('a', 'yellow', 'b', 'message-info cmd-ab'), @@ -109,7 +110,7 @@ def test_suggestions_special(keyhint, config_stub): config_stub.val.bindings.default = default_bindings config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', '') + keyhint.update_keyhint(usertypes.KeyMode.normal, '') assert keyhint.text() == expected_text( ('<Ctrl+c>', 'yellow', 'a', 'message-info cmd-Cca'), ('<Ctrl+c>', 'yellow', 'c', 'message-info cmd-Ccc'), @@ -130,7 +131,7 @@ def test_suggestions_with_count(keyhint, config_stub, monkeypatch, stubs): config_stub.val.bindings.default = bindings config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', '2a') + keyhint.update_keyhint(usertypes.KeyMode.normal, '2a') assert keyhint.text() == expected_text( ('a', 'yellow', 'b', 'bar'), ) @@ -146,7 +147,7 @@ def test_special_bindings(keyhint, config_stub): config_stub.val.bindings.default = {} config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', '<') + keyhint.update_keyhint(usertypes.KeyMode.normal, '<') assert keyhint.text() == expected_text( ('<', 'yellow', 'a', 'message-info cmd-<a'), @@ -159,7 +160,7 @@ def test_color_switch(keyhint, config_stub): config_stub.val.colors.keyhint.suffix.fg = '#ABCDEF' config_stub.val.bindings.default = {} config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', 'a') + keyhint.update_keyhint(usertypes.KeyMode.normal, 'a') assert keyhint.text() == expected_text(('a', '#ABCDEF', 'a', 'message-info cmd-aa')) @@ -173,7 +174,7 @@ def test_no_matches(keyhint, config_stub): config_stub.val.bindings.default = {} config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', 'z') + keyhint.update_keyhint(usertypes.KeyMode.normal, 'z') assert not keyhint.text() assert not keyhint.isVisible() @@ -196,7 +197,7 @@ def test_blacklist(keyhint, config_stub, blacklist, expected): config_stub.val.bindings.default = {} config_stub.val.bindings.commands = bindings - keyhint.update_keyhint('normal', 'a') + keyhint.update_keyhint(usertypes.KeyMode.normal, 'a') assert keyhint.text() == expected @@ -213,6 +214,6 @@ def test_delay(qtbot, stubs, monkeypatch, config_stub, key_config_stub): config_stub.val.bindings.commands = bindings keyhint = KeyHintView(0, None) - keyhint.update_keyhint('normal', 'a') + keyhint.update_keyhint(usertypes.KeyMode.normal, 'a') assert timer.isSingleShot() assert timer.interval() == interval