From be4ba3f1c6588fa519e08460121f5dac5837843e Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 4 Feb 2020 19:26:14 +0100 Subject: [PATCH] fix #3801 --- test/mitmproxy/test_command.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index a432f9e38..7158935a2 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -512,9 +512,15 @@ class TAttr: raise IOError +class TAttr2: + def __getattr__(self, item): + return TAttr2() + + class TCmds(TAttr): def __init__(self): self.TAttr = TAttr() + self.TAttr2 = TAttr2() @command.command("empty") def empty(self) -> None: @@ -524,7 +530,8 @@ class TCmds(TAttr): @pytest.mark.asyncio async def test_collect_commands(): """ - This tests for the error thrown by hasattr() + This tests for errors thrown by getattr() or __getattr__ implementations + that return an object for .command_name. """ with taddons.context() as tctx: c = command.CommandManager(tctx.master)