File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import sys
2+ from unittest .mock import MagicMock
3+
14import pytest
25
36
7+ @pytest .fixture (autouse = True , scope = "session" )
8+ def _mock_modal_decorators ():
9+ mock_modal = MagicMock ()
10+ mock_modal .Image .from_registry .return_value = MagicMock ()
11+ mock_modal .App .return_value = MagicMock ()
12+ mock_modal .Secret .from_name .return_value = MagicMock ()
13+ mock_modal .Queue .from_name .return_value = MagicMock ()
14+ mock_modal .Sandbox .list .return_value = []
15+ mock_modal .fastapi_endpoint = lambda ** kwargs : lambda f : f
16+ mock_app = MagicMock ()
17+ mock_app .function = lambda ** kwargs : lambda f : f
18+ mock_app .app_id = "test-app-id"
19+ mock_modal .App .return_value = mock_app
20+
21+ sys .modules ["modal" ] = mock_modal
22+
23+ yield
24+
25+ sys .modules .pop ("modal" , None )
26+
27+
428@pytest .fixture (autouse = True )
529def set_env (monkeypatch ):
630 monkeypatch .setenv ("WEBHOOK_SECRET" , "test-secret" )
You can’t perform that action at this time.
0 commit comments