[Executor] Convert sync generator to async generator #10036
GitHub Actions / SDK CLI Test Result [heta/sync-to-async](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:heta/sync-to-async++)
failed
May 8, 2024 in 0s
2 fail, 38 skipped, 643 pass in 1h 0m 57s
Annotations
Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_serve_fastapi
github-actions / SDK CLI Test Result [heta/sync-to-async](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:heta/sync-to-async++)
All 4 runs failed: test_stream_python_stream_tools[text/event-stream-200-text/event-stream; charset=utf-8] (tests.sdk_cli_test.e2etests.test_flow_serve_fastapi)
artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 0s]
Raw output
assert 406 == 200
+ where 406 = <Response [406 Not Acceptable]>.status_code
fastapi_serving_client_python_stream_tools = <starlette.testclient.TestClient object at 0x7fbac6c2c970>
accept = 'text/event-stream', expected_status_code = 200
expected_content_type = 'text/event-stream; charset=utf-8'
@pytest.mark.e2etest
@pytest.mark.parametrize(
"accept, expected_status_code, expected_content_type",
[
("text/event-stream", 200, "text/event-stream; charset=utf-8"),
("text/html", 406, "application/json"),
("application/json", 200, "application/json"),
("*/*", 200, "application/json"),
("text/event-stream, application/json", 200, "text/event-stream; charset=utf-8"),
("application/json, */*", 200, "application/json"),
("", 200, "application/json"),
],
)
def test_stream_python_stream_tools(
fastapi_serving_client_python_stream_tools,
accept,
expected_status_code,
expected_content_type,
):
payload = {
"text": "Hello World!",
}
headers = {
"Content-Type": "application/json",
"Accept": accept,
}
response = fastapi_serving_client_python_stream_tools.post("/score", json=payload, headers=headers)
res_content_type = response.headers.get("content-type")
> assert response.status_code == expected_status_code
E assert 406 == 200
E + where 406 = <Response [406 Not Acceptable]>.status_code
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_flow_serve_fastapi.py:309: AssertionError
Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_serve_fastapi
github-actions / SDK CLI Test Result [heta/sync-to-async](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:heta/sync-to-async++)
All 4 runs failed: test_stream_python_stream_tools[text/event-stream, application/json-200-text/event-stream; charset=utf-8] (tests.sdk_cli_test.e2etests.test_flow_serve_fastapi)
artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 0s]
Raw output
assert 500 == 200
+ where 500 = <Response [500 Internal Server Error]>.status_code
fastapi_serving_client_python_stream_tools = <starlette.testclient.TestClient object at 0x7fbac74405b0>
accept = 'text/event-stream, application/json', expected_status_code = 200
expected_content_type = 'text/event-stream; charset=utf-8'
@pytest.mark.e2etest
@pytest.mark.parametrize(
"accept, expected_status_code, expected_content_type",
[
("text/event-stream", 200, "text/event-stream; charset=utf-8"),
("text/html", 406, "application/json"),
("application/json", 200, "application/json"),
("*/*", 200, "application/json"),
("text/event-stream, application/json", 200, "text/event-stream; charset=utf-8"),
("application/json, */*", 200, "application/json"),
("", 200, "application/json"),
],
)
def test_stream_python_stream_tools(
fastapi_serving_client_python_stream_tools,
accept,
expected_status_code,
expected_content_type,
):
payload = {
"text": "Hello World!",
}
headers = {
"Content-Type": "application/json",
"Accept": accept,
}
response = fastapi_serving_client_python_stream_tools.post("/score", json=payload, headers=headers)
res_content_type = response.headers.get("content-type")
> assert response.status_code == expected_status_code
E assert 500 == 200
E + where 500 = <Response [500 Internal Server Error]>.status_code
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_flow_serve_fastapi.py:309: AssertionError
Loading