File tree Expand file tree Collapse file tree
tests/test_serverless/test_modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,13 +30,18 @@ def test_start_serverless_with_realtime(self):
3030 with patch (f"{ module_location } .Heartbeat.start_ping" , Mock ()) as mock_ping , \
3131 patch (f"{ module_location } .FastAPI" , Mock ()) as mock_fastapi , \
3232 patch (f"{ module_location } .APIRouter" , return_value = Mock ()) as mock_router , \
33- patch (f"{ module_location } .uvicorn" , Mock ()) as mock_uvicorn :
33+ patch (f"{ module_location } .uvicorn" , Mock ()) as mock_uvicorn , \
34+ patch ("runpod.serverless.os" ) as mock_os :
3435
3536 rp_fastapi .RUNPOD_REALTIME_PORT = '1111'
3637 rp_fastapi .RUNPOD_ENDPOINT_ID = 'test_endpoint_id'
3738
38- os .environ ["RUNPOD_REALTIME_PORT" ] = '1111'
39- os .environ ["RUNPOD_ENDPOINT_ID" ] = 'test_endpoint_id'
39+ # os.environ["RUNPOD_REALTIME_PORT"] = '1111'
40+ # mock return value for RUNPOD_REALTIME_PORT only
41+ mock_os .environ .get .side_effect = lambda x : '1111' if x == "RUNPOD_REALTIME_PORT" else None # pylint: disable=line-too-long
42+
43+ # os.environ["RUNPOD_ENDPOINT_ID"] = 'test_endpoint_id'
44+ mock_os .environ .get .side_effect = lambda x : 'test_endpoint_id' if x == "RUNPOD_ENDPOINT_ID" else None # pylint: disable=line-too-long
4045
4146 runpod .serverless .start ({"handler" : self .handler })
4247
You can’t perform that action at this time.
0 commit comments