Skip to content

Commit daf2fa5

Browse files
committed
test(sessions): Gate the PosixSessionUser repr tests on posix
The binding gates construction on `#[cfg(unix)]` and raises `RuntimeError: Only available on posix systems.` elsewhere, so the four tests that build one failed on the Windows matrix: 49 failures, exactly the 16+16+16+1 cases those tests parametrize. Mirrors the Rust guard with `os.name`. WindowsSessionUser gets no counterpart: off the process user it demands a password or a logon token, so it cannot be built with an arbitrary name just to read its repr. Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
1 parent eba7021 commit daf2fa5

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

test/openjd/sessions/test_repr.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
from __future__ import annotations
2323

24+
import os
25+
2426
import pytest
2527

2628
from openjd._openjd_rs import (
@@ -128,8 +130,16 @@ def test_repr_renders_none_exit_code(self) -> None:
128130
)
129131

130132

133+
@pytest.mark.skipif(os.name != "posix", reason="PosixSessionUser is constructible only on posix")
131134
class TestPosixSessionUserRepr:
132-
"""``user`` and ``group`` arrive from outside."""
135+
"""``user`` and ``group`` arrive from outside.
136+
137+
The binding gates construction on ``#[cfg(unix)]`` and raises
138+
``RuntimeError: Only available on posix systems.`` elsewhere, so these
139+
mirror that with ``os.name``. ``WindowsSessionUser`` has no counterpart
140+
here: off the process user it demands a password or a logon token, so
141+
it cannot be built with an arbitrary name just to read its repr.
142+
"""
133143

134144
@pytest.mark.parametrize("value", HOSTILE_STRINGS)
135145
def test_repr_parses_for_user(self, value: str) -> None:
@@ -158,6 +168,9 @@ def test_plain_action_result(self) -> None:
158168
"ActionResult(state=ActionState.SUCCESS, exit_code=0, stdout='ok')"
159169
)
160170

171+
@pytest.mark.skipif(
172+
os.name != "posix", reason="PosixSessionUser is constructible only on posix"
173+
)
161174
def test_plain_posix_session_user(self) -> None:
162175
assert repr(PosixSessionUser(user="alice", group="staff")) == (
163176
"PosixSessionUser(user='alice', group='staff')"

0 commit comments

Comments
 (0)