File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ jobs:
155155 - name : Run the automated tests
156156 run : |
157157 python --version
158- poetry run pytest -n auto -s -v --log-cli-level=INFO
158+ poetry run pytest -n auto --dist loadfile - s -v --log-cli-level=INFO
159159
160160 all-tests-passed :
161161 # This allows us to have a branch protection rule for tests and deploys with matrix
Original file line number Diff line number Diff line change @@ -923,6 +923,7 @@ def test_create_span_and_generation():
923923
924924 # Create initial span
925925 span = langfuse .start_span (name = "span" )
926+ sleep (0.1 )
926927 # Get trace ID for later use
927928 trace_id = span .trace_id
928929 # End the span
Original file line number Diff line number Diff line change 1111from langfuse import get_client , observe
1212from langfuse .langchain import CallbackHandler
1313from langfuse .media import LangfuseMedia
14- from langfuse .openai import AsyncOpenAI
1514from tests .utils import get_api
1615
1716mock_metadata = {"key" : "metadata" }
@@ -804,6 +803,8 @@ async def main_async(**kwargs):
804803
805804@pytest .mark .asyncio
806805async def test_async_nested_openai_chat_stream ():
806+ from langfuse .openai import AsyncOpenAI
807+
807808 mock_name = "test_async_nested_openai_chat_stream"
808809 langfuse = get_client ()
809810 mock_trace_id = langfuse .create_trace_id ()
Original file line number Diff line number Diff line change 1111from .utils import create_uuid
1212
1313
14- # to avoid the instanciation of langfuse in side langfuse.openai.
1514def _is_streaming_response (response ):
1615 return isinstance (response , types .GeneratorType ) or isinstance (
1716 response , types .AsyncGeneratorType
Original file line number Diff line number Diff line change @@ -61,16 +61,13 @@ def test_content_sha256_hash():
6161
6262def test_reference_string ():
6363 media = LangfuseMedia (content_bytes = SAMPLE_JPEG_BYTES , content_type = "image/jpeg" )
64- # Reference string should be None initially as media_id is not set
65- assert media ._reference_string is None
6664
67- # Set media_id
68- media ._media_id = "test-id"
65+ media ._media_id = "MwoGlsMS6lW8ijWeRyZKfD"
6966 reference = media ._reference_string
70- assert reference is not None
71- assert "test-id" in reference
72- assert " image/jpeg" in reference
73- assert "bytes" in reference
67+ assert (
68+ reference
69+ == "@@@langfuseMedia:type= image/jpeg|id=MwoGlsMS6lW8ijWeRyZKfD|source=bytes@@@"
70+ )
7471
7572
7673def test_parse_reference_string ():
You can’t perform that action at this time.
0 commit comments