Skip to content

4.9.2 test failure on NetBSD #449

@0-wiz-0

Description

@0-wiz-0

In 4.9.2 using the pypi distfile, there are three test failures on NetBSD:

FAILED tests/test_unix.py::test_xdg_variable_not_set[site_runtime_dir] - AssertionError: assert '/var/run' == '/run'
FAILED tests/test_unix.py::test_xdg_variable_empty_value[site_runtime_dir] - AssertionError: assert '/var/run' == '/run'
FAILED tests/test_unix.py::test_use_site_for_root_as_root[user_runtime_dir-/run/foo] - AssertionError: assert '/var/run/foo' == '/run/foo'

We had a patch for this in pkgsrc that fixes two of them:

--- tests/test_unix.py.orig     2020-02-02 00:00:00.000000000 +0000
+++ tests/test_unix.py
@@ -96,6 +96,10 @@ class XDGVariable(typing.NamedTuple):


 def _func_to_path(func: str) -> XDGVariable | None:
+    if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
+        site_default = '/var/run'
+    else:
+        site_default = '/run'
     mapping = {
         "user_data_dir": XDGVariable("XDG_DATA_HOME", "~/.local/share"),
         "site_data_dir": XDGVariable("XDG_DATA_DIRS", f"/usr/local/share{os.pathsep}/usr/share"),
@@ -105,7 +109,7 @@ def _func_to_path(func: str) -> XDGVaria
         "user_state_dir": XDGVariable("XDG_STATE_HOME", "~/.local/state"),
         "user_log_dir": XDGVariable("XDG_STATE_HOME", "~/.local/state"),
         "user_runtime_dir": XDGVariable("XDG_RUNTIME_DIR", f"{gettempdir()}/runtime-1234"),
-        "site_runtime_dir": XDGVariable("XDG_RUNTIME_DIR", "/run"),
+        "site_runtime_dir": XDGVariable("XDG_RUNTIME_DIR", site_default),
     }
     return mapping.get(func)

but I noticed in the commit log that OpenBSD now uses a different path, so that would need adaptations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions