Skip to content

Commit 20d3ee7

Browse files
committed
fix leaky state in tests
1 parent 976e0df commit 20d3ee7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/integration/mcp/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import pytest
66
import requests
77

8+
from dash import _get_app
9+
810
collect_ignore_glob = []
911
if sys.version_info < (3, 10):
1012
collect_ignore_glob.append("*")
@@ -16,6 +18,17 @@ def _enable_mcp_for_integration_tests(monkeypatch):
1618
monkeypatch.setenv("DASH_MCP_ENABLED", "true")
1719

1820

21+
@pytest.fixture(autouse=True)
22+
def _reset_dash_app_state():
23+
"""Reset Dash module-level state after each MCP test.
24+
25+
TODO: this can be removed when 4.2 backend work lands
26+
"""
27+
yield
28+
_get_app.APP = None
29+
_get_app.app_context.set(None)
30+
31+
1932
def _mcp_post(server_url, method, params=None, request_id=1):
2033
return requests.post(
2134
f"{server_url}/_mcp",

0 commit comments

Comments
 (0)