From d9f2b4d646d64ab3b2e0cfaa8b4e68aac727c90e Mon Sep 17 00:00:00 2001 From: Guillaume Aquilina Date: Thu, 10 Apr 2025 14:50:20 +0200 Subject: [PATCH] chore: prepare for using pytest to run examples --- Makefile | 3 +++ examples/06_streaming_summary.py | 2 +- poetry.lock | 38 ++++++++++++++++++++++++++++++-- pyproject.toml | 1 + 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9c2bd9f..9b4c84a 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,6 @@ test: .PHONY: lock lock: poetry lock --no-update + +test.examples: + pytest examples -n=5 diff --git a/examples/06_streaming_summary.py b/examples/06_streaming_summary.py index 23617bc..aa82114 100644 --- a/examples/06_streaming_summary.py +++ b/examples/06_streaming_summary.py @@ -28,7 +28,7 @@ class TranslationOutput(BaseModel): ) -@workflowai.agent(id="french-translator", model=Model.CLAUDE_3_5_SONNET_LATEST) +@workflowai.agent(id="french-translator", model=Model.GEMINI_2_0_FLASH_LATEST) async def translate_to_english(_: TranslationInput) -> TranslationOutput: """ Translate French text into natural, fluent English. diff --git a/poetry.lock b/poetry.lock index 39ae623..3969b8d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. [[package]] name = "annotated-types" @@ -105,6 +105,20 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "execnet" +version = "2.1.1" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "execnet-2.1.1-py3-none-any.whl", hash = "sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc"}, + {file = "execnet-2.1.1.tar.gz", hash = "sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "filelock" version = "3.17.0" @@ -560,6 +574,26 @@ pytest = "==8.*" [package.extras] testing = ["pytest-asyncio (==0.24.*)", "pytest-cov (==6.*)"] +[[package]] +name = "pytest-xdist" +version = "3.6.1" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, + {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -821,4 +855,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "5116675c3d4551c562da2dd230d9497cc16085b171fc72cc48bb2868c98acfba" +content-hash = "2e8fea1be59caf36cf68656e8981d51d025818d6063992ce622664fba0ff9e8d" diff --git a/pyproject.toml b/pyproject.toml index 93aaf0d..171af3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ httpx = ">=0.27" pyright = "^1.1.390" pytest = "^8.2.2" pytest-asyncio = "^0.25.3" +pytest-xdist = "^3.6.1" ruff = "^0.9.6" freezegun = "^1.5.1" pre-commit = "^4.0.1"