Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unittest.mock.patch does not work on WASM build #96630

Closed
treyhunner opened this issue Sep 6, 2022 · 1 comment
Closed

unittest.mock.patch does not work on WASM build #96630

treyhunner opened this issue Sep 6, 2022 · 1 comment
Labels
3.11 only security fixes 3.12 bugs and security fixes OS-wasi stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@treyhunner
Copy link
Member

Bug report

When importing unittest.mock, an exception is raised due to unittest.mock importing asyncio.

It seems the asyncio library is only used in unittest.mock when mocking async functions.

I believe delaying the import of asyncio until the moment it's needed would make unittest.mock functional for most use cases on WASM builds.

A demonstration of the error: https://www.pythonmorsels.com/r/35fv2/

Your environment

CPython 3.11.0rc1 built with Emscripten for the web browser

@treyhunner treyhunner added the type-bug An unexpected behavior, bug, or error label Sep 6, 2022
@gpshead gpshead added 3.11 only security fixes 3.12 bugs and security fixes stdlib Python modules in the Lib dir labels Sep 13, 2022
@brettcannon brettcannon removed their assignment Oct 4, 2022
@treyhunner
Copy link
Member Author

Duplicate of #96883. I accidentally opened this issue twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes OS-wasi stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants