aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-05-12 10:15:08 +1200
committerAldo Cortesi <aldo@corte.si>2018-05-12 10:15:08 +1200
commit6dff8c58adbcb9da9b7bdeb088148c3f0d364c02 (patch)
treecf716b1581de9ff1845658da00905c8723576f24 /test
parent75d30212c253682f61d12b6cca5c910c798e18e1 (diff)
downloadmitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.tar.gz
mitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.tar.bz2
mitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.zip
commands: if no explicit return type is specified, assume None
This is going to be a super common error for addon authors, so we might as well handle it.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_command.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index ea1017e7..22ebcc21 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -55,7 +55,20 @@ class TAddon:
pass
+class TypeErrAddon:
+ @command.command("noret")
+ def noret(self):
+ pass
+
+
class TestCommand:
+ def test_typecheck(self):
+ with taddons.context(loadcore=False) as tctx:
+ cm = command.CommandManager(tctx.master)
+ a = TypeErrAddon()
+ c = command.Command(cm, "noret", a.noret)
+ print(c.signature_help())
+
def test_varargs(self):
with taddons.context() as tctx:
cm = command.CommandManager(tctx.master)