From c237297b3d673b8d141a388991c3a4b182e12332 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 24 Feb 2023 23:23:44 +0100 Subject: [PATCH] Fix OSError in tmpdir on emscripten due to missing getuid() Fixes #10765 --- changelog/10765.bugfix.rst | 1 + src/_pytest/tmpdir.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/10765.bugfix.rst diff --git a/changelog/10765.bugfix.rst b/changelog/10765.bugfix.rst new file mode 100644 index 000000000..754abd72c --- /dev/null +++ b/changelog/10765.bugfix.rst @@ -0,0 +1 @@ +Fix temp_path fixture always raising OSError on emscripten due to missing getuid diff --git a/src/_pytest/tmpdir.py b/src/_pytest/tmpdir.py index ec44623dc..64f1de072 100644 --- a/src/_pytest/tmpdir.py +++ b/src/_pytest/tmpdir.py @@ -176,7 +176,7 @@ class TempPathFactory: # Also, to keep things private, fixup any world-readable temp # rootdir's permissions. Historically 0o755 was used, so we can't # just error out on this, at least for a while. - if sys.platform != "win32": + if sys.platform != "win32" and sys.platform != "emscripten": uid = os.getuid() rootdir_stat = rootdir.stat() # getuid shouldn't fail, but cpython defines such a case.