mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
build: move to uv (#488)
* build: move to uv * build: add packages declaration * build: move to python 3.12, as sentencespiece does not work on 3.13 * ci: remove pre-commit check, will be done in another branch. * ci: fix name checkout * ci: update lock and dockerfile * test: remove event_loop, not needed in python 3.12 * test: updated test due to av returning AudioFrame with 4096 samples instead of 1024 * build: prevent using fastapi cli, because there is no way to set default port I don't want to pass --port 1250 every time, so back on previous approach. I deactivated auto-reload for production. * ci: remove main.py * test: fix quirck with httpx
This commit is contained in:
@@ -84,7 +84,7 @@ from unittest import mock
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
async def test_processors_audio_diarization(event_loop, name, diarization, expected):
|
||||
async def test_processors_audio_diarization(name, diarization, expected):
|
||||
from reflector.processors.audio_diarization import AudioDiarizationProcessor
|
||||
from reflector.processors.types import (
|
||||
TitleSummaryWithId,
|
||||
|
||||
@@ -3,7 +3,6 @@ import pytest
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_basic_process(
|
||||
event_loop,
|
||||
nltk,
|
||||
dummy_transcript,
|
||||
dummy_llm,
|
||||
@@ -34,8 +33,8 @@ async def test_basic_process(
|
||||
print(marks)
|
||||
|
||||
# validate the events
|
||||
assert marks["TranscriptLinerProcessor"] == 4
|
||||
assert marks["TranscriptTranslatorProcessor"] == 4
|
||||
assert marks["TranscriptLinerProcessor"] == 1
|
||||
assert marks["TranscriptTranslatorProcessor"] == 1
|
||||
assert marks["TranscriptTopicDetectorProcessor"] == 1
|
||||
assert marks["TranscriptFinalSummaryProcessor"] == 1
|
||||
assert marks["TranscriptFinalTitleProcessor"] == 1
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
import asyncio
|
||||
import pytest
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from reflector.utils.retry import (
|
||||
retry,
|
||||
RetryTimeoutException,
|
||||
RetryHTTPException,
|
||||
RetryException,
|
||||
RetryHTTPException,
|
||||
RetryTimeoutException,
|
||||
retry,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_retry_redirect(httpx_mock):
|
||||
async def custom_response(request: httpx.Request):
|
||||
if request.url.path == "/hello":
|
||||
await asyncio.sleep(1)
|
||||
return httpx.Response(
|
||||
status_code=303, headers={"location": "https://test_url/redirected"}
|
||||
)
|
||||
elif request.url.path == "/redirected":
|
||||
return httpx.Response(status_code=200, json={"hello": "world"})
|
||||
else:
|
||||
raise Exception("Unexpected path")
|
||||
httpx_mock.add_response(
|
||||
url="https://test_url/hello",
|
||||
status_code=303,
|
||||
headers={"location": "https://test_url/redirected"},
|
||||
)
|
||||
httpx_mock.add_response(
|
||||
url="https://test_url/redirected",
|
||||
status_code=200,
|
||||
json={"hello": "world"},
|
||||
)
|
||||
|
||||
httpx_mock.add_callback(custom_response)
|
||||
async with httpx.AsyncClient() as client:
|
||||
# timeout should not triggered, as it will end up ok
|
||||
# even though the first request is a 303 and took more that 0.5
|
||||
@@ -37,7 +36,7 @@ async def test_retry_redirect(httpx_mock):
|
||||
@pytest.mark.asyncio
|
||||
async def test_retry_httpx(httpx_mock):
|
||||
# this code should be force a retry
|
||||
httpx_mock.add_response(status_code=500)
|
||||
httpx_mock.add_response(status_code=500, is_reusable=True)
|
||||
async with httpx.AsyncClient() as client:
|
||||
with pytest.raises(RetryTimeoutException):
|
||||
await retry(client.get)("https://test_url", retry_timeout=0.1)
|
||||
|
||||
Reference in New Issue
Block a user