Skip to content

Fix OSError in tmpdir on emscripten due to missing getuid() - #10766

Merged
Zac-HD merged 4 commits into
pytest-dev:mainfrom
rdb:fix-10765
Mar 5, 2023
Merged

Zac-HD merged 4 commits into
pytest-dev:mainfrom
rdb:fix-10765

Conversation

@rdb

@rdb rdb commented Feb 24, 2023

Copy link
Copy Markdown
Contributor

Emscripten defines getuid() as a stub that always returns 0. This change is necessary for our unit testing suite to pass under node.js.

Have no need to be added to AUTHORS for such a trivial change.

Closes #10765

Comment thread changelog/10765.bugfix.rst Outdated
Comment thread changelog/10765.bugfix.rst Outdated
@nicoddemus

Copy link
Copy Markdown
Member

Thanks @rdb!

FYI decided to move the uid-handling logic to a separate function in _pytest.compat.

Would appreciate a second set of eyes reviewing the change. 👍

Comment thread src/_pytest/compat.py


def legacy_path(path: Union[str, "os.PathLike[str]"]) -> LEGACY_PATH:
def legacy_path(path: str | os.PathLike[str]) -> LEGACY_PATH:

@nicoddemus nicoddemus Feb 28, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: type annotation changes were introduced by pyupgrade because I added the from __future__ import annotations import.

@nicoddemus nicoddemus added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Feb 28, 2023
@rdb

rdb commented Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

Thanks. Seems fine, I built with your changes and our test suite is still passing.

@Zac-HD Zac-HD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, let's merge 👍

@Zac-HD
Zac-HD merged commit b3b44ea into pytest-dev:main Mar 5, 2023
@rdb
rdb deleted the fix-10765 branch March 7, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tmp_path always raises exception on emscripten

3 participants