You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add unit tests for desktop platform detection in utils #40
tests/test_utils.py covers _detect_ios() thoroughly, but there are no unit tests for _detect_desktop() or for the mutual exclusion between IS_ANDROID, IS_IOS, and IS_DESKTOP (see src/pythonnative/utils.py, lines 83-105 and 144).
Suggested fix
Add a test class to tests/test_utils.py, following the existing _detect_ios monkeypatch pattern, covering at least:
PN_PLATFORM=desktop makes _detect_desktop() return True.
PN_PLATFORM unset, empty, or set to another value (for example ios) makes it return False.
The combination logic around line 105 (_is_desktop = (not _is_android) and (not _is_ios) and _detect_desktop()): when an Android or iOS signal is present, the desktop flag stays False, so the three flags are mutually exclusive.
Verification
pytest -q tests/test_utils.py and ./scripts/check.sh pass.
I'd like to take this one. Plan: add a TestDesktopDetection class to tests/test_utils.py following the existing _detect_ios monkeypatch pattern, covering: PN_PLATFORM=desktop makes _detect_desktop() return True; PN_PLATFORM unset/empty/set to another value (e.g. ios) returns False; and the mutual-exclusion logic around utils.py line 105, asserting the desktop flag stays False when an Android or iOS signal is present. Will make sure pytest -q tests/test_utils.py and ./scripts/check.sh pass.
Activity
glenlouis8 commentedon Sep 1, 2026
I'd like to take this one. Plan: add a TestDesktopDetection class to tests/test_utils.py following the existing _detect_ios monkeypatch pattern, covering: PN_PLATFORM=desktop makes _detect_desktop() return True; PN_PLATFORM unset/empty/set to another value (e.g. ios) returns False; and the mutual-exclusion logic around utils.py line 105, asserting the desktop flag stays False when an Android or iOS signal is present. Will make sure pytest -q tests/test_utils.py and ./scripts/check.sh pass.
glenlouis8 commentedon Sep 2, 2026
Opened #68 for this.
test(utils): cover desktop platform detection (#68)