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

Function test_android_folder_from_p4a

tests/test_android.py:112–132  ·  view source on GitHub ↗
(mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

110
111
112def test_android_folder_from_p4a(mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch) -> None:
113 from platformdirs.android import _android_folder # noqa: PLC0415
114
115 mocker.patch.dict(sys.modules, {"jnius": MagicMock(side_effect=ModuleNotFoundError)})
116 monkeypatch.delitem(__import__("sys").modules, "jnius")
117
118 _android_folder.cache_clear()
119
120 get_absolute_path = MagicMock(return_value="/A")
121 get_parent_file = MagicMock(getAbsolutePath=get_absolute_path)
122 get_files_dir = MagicMock(getParentFile=MagicMock(return_value=get_parent_file))
123 get_application_context = MagicMock(getFilesDir=MagicMock(return_value=get_files_dir))
124 m_activity = MagicMock(getApplicationContext=MagicMock(return_value=get_application_context))
125 mocker.patch.dict(sys.modules, {"android": MagicMock(mActivity=m_activity)})
126
127 result = _android_folder()
128 assert result == "/A"
129 assert get_absolute_path.call_count == 1
130
131 assert _android_folder() is result
132 assert get_absolute_path.call_count == 1
133
134
135@pytest.mark.parametrize(

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…