Skip to content

Commit

Permalink
Revert sys.platform verification to simple comparison (pytest-dev#11998)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nicoddemus authored Feb 17, 2024
1 parent aebeb33 commit 5f241f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/_pytest/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f241f3

Please sign in to comment.