MCPcopy Create free account
hub / github.com/tox-dev/platformdirs / test_android_active

Function test_android_active

tests/test_api.py:67–92  ·  view source on GitHub ↗
(  # noqa: PLR0913
    monkeypatch: pytest.MonkeyPatch,
    root: str | None,
    data: str | None,
    path: str,
    shell: str | None,
    prefix: str | None,
)

Source from the content-addressed store, hash-verified

65@pytest.mark.parametrize("shell", ["/data/data/com.app/files/usr/bin/sh", "/usr/bin/sh", None])
66@pytest.mark.parametrize("prefix", ["/data/data/com.termux/files/usr", None])
67def test_android_active( # noqa: PLR0913
68 monkeypatch: pytest.MonkeyPatch,
69 root: str | None,
70 data: str | None,
71 path: str,
72 shell: str | None,
73 prefix: str | None,
74) -> None:
75 for env_var, value in {"ANDROID_DATA": data, "ANDROID_ROOT": root, "SHELL": shell, "PREFIX": prefix}.items():
76 if value is None:
77 monkeypatch.delenv(env_var, raising=False)
78 else:
79 monkeypatch.setenv(env_var, value)
80
81 from platformdirs.android import _android_folder # noqa: PLC0415
82
83 _android_folder.cache_clear()
84 monkeypatch.setattr(sys, "path", ["/A", "/B", path])
85
86 expected = (
87 root == "/system" and data == "/data" and shell is None and prefix is None and _android_folder() is not None
88 )
89 if expected:
90 assert platformdirs._set_platform_dir_class() is Android # noqa: SLF001
91 else:
92 assert platformdirs._set_platform_dir_class() is not Android # noqa: SLF001
93
94
95def _fake_import(

Callers

nothing calls this directly

Calls 1

_android_folderFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…