mypy: zulip: Fix errors in tests/test_default_arguments.py.
MODIFY
tools/run-mypy
tools/run-mypy
@@ -20,7 +20,6 @@ sys.path.append(os.path.dirname(TOOLS_DIR))
exclude = """
zulip/integrations/perforce/git_p4.py
-zulip/tests/test_default_arguments.py
zulip_bots/zulip_bots/bots
zulip_bots/generate_manifest.py

MODIFY
zulip/tests/test_default_arguments.py
zulip/tests/test_default_arguments.py
@@ -16,8 +16,10 @@ else:
class TestDefaultArguments(TestCase):
def test_invalid_arguments(self):
+ # type: () -> None
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage="lorem ipsum"))
- with self.assertRaises(SystemExit) as cm, patch('sys.stderr', new=six.StringIO()) as mock_stderr:
+ with self.assertRaises(SystemExit) as cm: # type: ignore # error: "assertRaises" doesn't match argument types
+ with patch('sys.stderr', new=six.StringIO()) as mock_stderr:
parser.parse_args(['invalid argument'])
self.assertEqual(cm.exception.code, 2)
# Assert that invalid arguments exit with printing the full usage (non-standard behavior)
@@ -32,6 +34,7 @@ Zulip API configuration:
@patch('os.path.exists', return_value=False)
def test_config_path_with_tilde(self, mock_os_path_exists):
+ # type: (bool) -> None
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage="lorem ipsum"))
test_path = '~/zuliprc'
args = parser.parse_args(['--config-file', test_path])

mypy: zulip: Fix errors in tests/test_default_arguments.py.