Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tmp_path always raises exception on emscripten #10765

@rdb

Description

@rdb

Our unit test suite is always failing when building for emscripten-wasm32, because getuid in emscripten always returns 0. This causes the following exception to always trip:

if sys.platform != "win32":
uid = os.getuid()
rootdir_stat = rootdir.stat()
# getuid shouldn't fail, but cpython defines such a case.
# Let's hope for the best.
if uid != -1:
if rootdir_stat.st_uid != uid:
raise OSError(
f"The temporary directory {rootdir} is not owned by the current user. "
"Fix this and try again."
)

The trivial fix is just to add and sys.platform != "emscripten" to the if check. Adding this makes our test suite pass.

I would have made a PR but I don't want to add my name to AUTHORS.

Encountered with Python 3.11.2+, pytest 7.2.1, and node.js v14.18.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions