Skip to content

Commit

Permalink
Fix ci test of test_invoke_sync_function_in_process_set_env
Browse files Browse the repository at this point in the history
  • Loading branch information
PeiwenGaoMS committed Apr 25, 2024
1 parent 108e067 commit 4493bb0
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def target_function(request: int):
return request


def target_function_get_env(environment_variable: str):
return os.getenv(environment_variable)


@pytest.mark.unittest
class TestProcessUtils:
@pytest.mark.asyncio
Expand Down Expand Up @@ -77,16 +81,13 @@ async def test_invoke_sync_function_in_process_unexpected_error(self):

@pytest.mark.asyncio
async def test_invoke_sync_function_in_process_set_env(self):
def target_function_get_env(environment_variable: str):
return os.getenv(environment_variable)

with patch("promptflow.executor._service.utils.process_utils.service_logger") as mock_logger:
environment_variables = {"test_env_name": "test_env_value"}
result = await invoke_sync_function_in_process(
target_function_get_env,
args=("test_env_name",),
context_dict=MOCK_CONTEXT_DICT,
environment_variables=environment_variables
environment_variables=environment_variables,
)
assert result == "test_env_value"
assert mock_logger.info.call_count == 2
Expand Down

0 comments on commit 4493bb0

Please sign in to comment.