From df5afbc1035a9d21223ccddec5af658c580b2e70 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 17 Feb 2024 12:57:29 -0300 Subject: [PATCH] Revert sys.platform verification to simple comparison As the comment above it states, we need to keep the comparison simple so mypy can understand it, otherwise it will fail to properly handle this on Windows and will flag ``os.getuid()`` missing. --- src/_pytest/compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 077fa65da..fa387f6db 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -289,7 +289,7 @@ def get_user_id() -> int | None: # mypy follows the version and platform checking expectation of PEP 484: # https://mypy.readthedocs.io/en/stable/common_issues.html?highlight=platform#python-version-and-system-platform-checks # Containment checks are too complex for mypy v1.5.0 and cause failure. - if sys.platform in {"win32", "emscripten"}: + if sys.platform == "win32" or sys.platform == "emscripten": # noqa: PLR1714 # win32 does not have a getuid() function. # Emscripten has a return 0 stub. return None