Skip to content

Commit 99530d3

Browse files
committed
address greptime comments
1 parent 74fc902 commit 99530d3

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

posthog/test/test_client.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,15 +2232,10 @@ def test_mock_system_context(
22322232

22332233
# Special handling for Linux which uses distro module
22342234
if sys_platform == "linux":
2235-
# Directly patch the get_os_info function to return our expected values
2236-
with mock.patch(
2237-
"posthog.utils.get_os_info",
2238-
return_value={
2239-
"$os": expected_os,
2240-
"$os_version": expected_os_version,
2241-
"$os_distro": expected_os_distro,
2242-
},
2243-
):
2235+
with mock.patch("posthog.utils.distro") as mock_distro:
2236+
mock_distro.info.return_value = {"version": expected_os_version}
2237+
mock_distro.name.return_value = expected_os_distro or ""
2238+
22442239
from posthog.utils import system_context
22452240

22462241
context = system_context()
@@ -2258,7 +2253,7 @@ def test_mock_system_context(
22582253
"$os_version": expected_os_version,
22592254
}
22602255

2261-
if expected_os_distro:
2256+
if sys_platform == "linux":
22622257
expected_context["$os_distro"] = expected_os_distro
22632258

22642259
assert context == expected_context

0 commit comments

Comments
 (0)