Skip to content

unitest.mock.create_autospec(async_def) does not create functions valid for inspect.iscoroutinefunction #94924

Closed
@graingert

Description

@graingert

discovered while creating #94923

Bug report

import unittest.mock import inspect import asyncio import sys def main(): async def demo(): pass print(f"{inspect.iscoroutinefunction(unittest.mock.create_autospec(demo))=}") print(f"{asyncio.iscoroutinefunction(unittest.mock.create_autospec(demo))=}") # this prints: # inspect.iscoroutinefunction(unittest.mock.create_autospec(demo))=False # asyncio.iscoroutinefunction(unittest.mock.create_autospec(demo))=True if __name__ == "__main__": sys.exit(main())

see also #84753

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions