Skip to content

Not able to use dpytest for hybrid commands #126

@aarti98

Description

@aarti98

Recently, we added hybrid commands in our project and it is working alright. But since we converted few commands into autocomplete commands using @hybrid_command, respective test cases are failing with simple assertion error:
dpytest-error

If i try to sync my commands with this code:

@b.event
   async def setup_hook():  # type: ignore
       """Hooking setup."""
       print(f"{b.user} is now running!")
       for cog in settings.COGS_LIST:
           await b.load_extension(cog)
           print(f"Loaded Cog: {cog}")
           await b.tree.sync()

   # await b.start(settings.DISCORD_BOT_TOKEN_STAGING)
   await b._async_setup_hook()  # noqa: SLF001 # type: ignore
   await b.setup_hook()
   dpytest.configure(b)
   yield b

   # Teardown
   await dpytest.empty_queue()

I get the following error:

discord.app_commands.errors.MissingApplicationID

How can I add test cases for hybrid command in dpytest?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions