44
55from posthog .capture_mode import CaptureMode
66from posthog .mcp import PostHogMCP
7- from posthog .mcp .version import __version__ as MCP_VERSION
87from posthog .test .mcp ._helpers import (
98 events_named as _events ,
109 flush_background as _flush ,
1110)
11+ from posthog .version import VERSION
1212
1313
1414def make_client ():
@@ -73,7 +73,7 @@ def before_send(event):
7373 assert {event ["event" ] for event in captured } == {"$mcp_tool_call" , "$exception" }
7474 assert all (
7575 event ["properties" ]["$lib" ] == "posthog-python-mcp"
76- and event ["properties" ]["$lib_version" ] == MCP_VERSION
76+ and event ["properties" ]["$lib_version" ] == VERSION
7777 for event in captured
7878 )
7979
@@ -86,7 +86,7 @@ def test_mcp_library_identity_reaches_capture_v0_header():
8686 client .capture ("$mcp_custom" )
8787
8888 assert post .call_args .kwargs ["headers" ]["User-Agent" ] == (
89- f"posthog-python-mcp/{ MCP_VERSION } "
89+ f"posthog-python-mcp/{ VERSION } "
9090 )
9191
9292
@@ -95,10 +95,10 @@ def test_mcp_library_identity_reaches_capture_v1_header():
9595 with mock .patch ("posthog.client._send_v1_batch" ) as send :
9696 client .capture ("$mcp_custom" )
9797
98- assert send .call_args .kwargs ["sdk_info" ] == f"posthog-python-mcp/{ MCP_VERSION } "
98+ assert send .call_args .kwargs ["sdk_info" ] == f"posthog-python-mcp/{ VERSION } "
9999 event = send .call_args .args [2 ][0 ]
100100 assert event ["properties" ]["$lib" ] == "posthog-python-mcp"
101- assert event ["properties" ]["$lib_version" ] == MCP_VERSION
101+ assert event ["properties" ]["$lib_version" ] == VERSION
102102
103103
104104def test_mcp_library_identity_reaches_feature_flag_requests ():
@@ -112,7 +112,7 @@ def test_mcp_library_identity_reaches_feature_flag_requests():
112112 client .evaluate_flags ("user_1" )
113113
114114 assert post .call_args .kwargs ["headers" ]["User-Agent" ] == (
115- f"posthog-python-mcp/{ MCP_VERSION } "
115+ f"posthog-python-mcp/{ VERSION } "
116116 )
117117
118118
@@ -130,7 +130,7 @@ def test_mcp_library_identity_reaches_feature_flag_definition_requests():
130130 client .load_feature_flags ()
131131
132132 assert get .call_args .kwargs ["headers" ]["User-Agent" ] == (
133- f"posthog-python-mcp/{ MCP_VERSION } "
133+ f"posthog-python-mcp/{ VERSION } "
134134 )
135135 client .shutdown ()
136136
@@ -144,7 +144,7 @@ def test_mcp_library_identity_reaches_remote_config_requests():
144144 assert client .get_remote_config_payload ("flag-key" ) == "payload"
145145
146146 assert get .call_args .kwargs ["headers" ]["User-Agent" ] == (
147- f"posthog-python-mcp/{ MCP_VERSION } "
147+ f"posthog-python-mcp/{ VERSION } "
148148 )
149149
150150
0 commit comments