Skip to content

unittest.mock does not work on WebAssembly build of CPython #96883

Closed
@treyhunner

Description

Bug report

Use CPython compiled for WebAssembly and then import unittest.mock

Or visit this page and click the "Run in Browser" button to see the error.

The error shown is:

Traceback (most recent call last):
  File "//__main__.py", line 2, in <module>
    import unittest.mock
  File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/unittest/mock.py", line 26, in <module>
  File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/asyncio/__init__.py", line 8, in <module>
  File "/home/runner/work/cpython-wasm-test/cpython-wasm-test/cpython/Lib/asyncio/base_events.py", line 18, in <module>
ModuleNotFoundError: No module named 'concurrent'

This error seems to only occur on the WebAssembly build for the browser (the Node build allows unittest.mock to be imported as expected).

Your environment

  • CPython versions tested on: 3.11.0rc2
  • Operating system and architecture: WebAssembly

Metadata

Assignees

No one assigned

    Labels

    OS-wasitype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions