Merge pull request #3809 from mhils/issue-3801

fix #3801
This commit is contained in:
Maximilian Hils 2020-02-04 21:39:15 +01:00 committed by GitHub
commit 735b8e35c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -512,9 +512,15 @@ class TAttr:
raise IOError raise IOError
class TAttr2:
def __getattr__(self, item):
return TAttr2()
class TCmds(TAttr): class TCmds(TAttr):
def __init__(self): def __init__(self):
self.TAttr = TAttr() self.TAttr = TAttr()
self.TAttr2 = TAttr2()
@command.command("empty") @command.command("empty")
def empty(self) -> None: def empty(self) -> None:
@ -524,7 +530,8 @@ class TCmds(TAttr):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_collect_commands(): 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: with taddons.context() as tctx:
c = command.CommandManager(tctx.master) c = command.CommandManager(tctx.master)