55from io import StringIO , BytesIO
66
77import azure .functions as func
8- from azure .functions ._abc import TraceContext , RetryContext
8+ from azure .functions ._abc import TraceContext , RetryContext , WarmUpContext
99from azure .functions ._http import HttpResponseHeaders
1010from azure .functions ._http_wsgi import (
1111 WsgiRequest ,
@@ -223,15 +223,17 @@ def _generate_func_context(
223223 function_name = 'httptrigger' ,
224224 function_directory = '/home/roger/wwwroot/httptrigger' ,
225225 trace_context = TraceContext ,
226- retry_context = RetryContext
226+ retry_context = RetryContext ,
227+ warmup_context = WarmUpContext
227228 ) -> func .Context :
228229 class MockContext (func .Context ):
229- def __init__ (self , ii , fn , fd , tc , rc ):
230+ def __init__ (self , ii , fn , fd , tc , rc , wc ):
230231 self ._invocation_id = ii
231232 self ._function_name = fn
232233 self ._function_directory = fd
233234 self ._trace_context = tc
234235 self ._retry_context = rc
236+ self ._warmup_context = wc
235237
236238 @property
237239 def invocation_id (self ):
@@ -253,8 +255,12 @@ def trace_context(self):
253255 def retry_context (self ):
254256 return self ._retry_context
255257
258+ @property
259+ def warmup_context (self ):
260+ return self ._warmup_context
261+
256262 return MockContext (invocation_id , function_name , function_directory ,
257- trace_context , retry_context )
263+ trace_context , retry_context , warmup_context )
258264
259265 def _generate_wsgi_app (self ,
260266 status = '200 OK' ,
0 commit comments