Skip to content

Commit a64e02f

Browse files
harupyBenWilson2
andauthored
Turn PytestUnhandledCoroutineWarning into an error (mlflow#14399)
Signed-off-by: harupy <[email protected]> Signed-off-by: Ben Wilson <[email protected]> Co-authored-by: Ben Wilson <[email protected]>
1 parent 75171e7 commit a64e02f

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

pytest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ filterwarnings =
55
error:^`np\.[a-z]+` is a deprecated alias for.+:DeprecationWarning:mlflow
66
error:^`np\.[a-z]+` is a deprecated alias for.+:DeprecationWarning:tests
77
error::pytest.PytestCollectionWarning
8+
# TODO: In pytest 8.4.0 (not released yet), this can be removed.
9+
# Raise an error if async tests without the `@pytest.mark.asyncio` decorator are found.
10+
error::pytest.PytestUnhandledCoroutineWarning
811
timeout = 1200

tests/gateway/providers/test_palm.py

+21-16
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,26 @@ def embeddings_response():
241241
def embeddings_batch_response():
242242
return {
243243
"embeddings": [
244-
[
245-
3.25,
246-
0.7685547,
247-
2.65625,
248-
-0.30126953,
249-
-2.3554688,
250-
1.2597656,
251-
],
252-
[
253-
7.25,
254-
0.7685547,
255-
4.65625,
256-
-0.30126953,
257-
-2.3554688,
258-
8.2597656,
259-
],
244+
{
245+
"value": [
246+
3.25,
247+
0.7685547,
248+
2.65625,
249+
-0.30126953,
250+
-2.3554688,
251+
1.2597656,
252+
]
253+
},
254+
{
255+
"value": [
256+
7.25,
257+
0.7685547,
258+
4.65625,
259+
-0.30126953,
260+
-2.3554688,
261+
8.2597656,
262+
]
263+
},
260264
],
261265
"headers": {"Content-Type": "application/json"},
262266
}
@@ -294,6 +298,7 @@ async def test_embeddings(prompt):
294298
mock_post.assert_called_once()
295299

296300

301+
@pytest.mark.asyncio
297302
async def test_embeddings_batch():
298303
config = embeddings_config()
299304
with mock.patch(

0 commit comments

Comments
 (0)