Skip to content

Commit 548df93

Browse files
committed
refactor(agents-api): Migrate to pytest from ward
Signed-off-by: Diwank Singh Tomer <[email protected]>
1 parent c6dff1e commit 548df93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4059
-5652
lines changed

AGENTS.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Julep is a serverless platform for building AI workflows and agents. It helps da
2424
| #: | AI *may* do | AI *must NOT* do |
2525
|---|------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
2626
| G-0 | Whenever unsure about something that's related to the project, ask the developer for clarification before making changes. | ❌ Write changes or use tools when you are not sure about something project specific, or if you don't have context for a particular feature/decision. |
27-
| G-1 | Generate code **only inside** relevant source directories (e.g., `agents_api/` for the main API, `cli/src/` for the CLI, `integrations/` for integration-specific code) or explicitly pointed files. | ❌ Touch `tests/`, `SPEC.md`, or any `*_spec.py` / `*.ward` files (humans own tests & specs). |
27+
| G-1 | Generate code **only inside** relevant source directories (e.g., `agents_api/` for the main API, `cli/src/` for the CLI, `integrations/` for integration-specific code) or explicitly pointed files. | ❌ Touch `tests/`, `SPEC.md`, or any `*_spec.py` files (humans own tests & specs). |
2828
| G-2 | Add/update **`AIDEV-NOTE:` anchor comments** near non-trivial edited code. | ❌ Delete or mangle existing `AIDEV-` comments. |
2929
| G-3 | Follow lint/style configs (`pyproject.toml`, `.ruff.toml`, `.pre-commit-config.yaml`). Use the project's configured linter, if available, instead of manually re-formatting code. | ❌ Re-format code to any other style. |
3030
| G-4 | For changes >300 LOC or >3 files, **ask for confirmation**. | ❌ Refactor large modules without human guidance. |
@@ -41,8 +41,8 @@ Use `poe` tasks for consistency (they ensure correct environment variables and c
4141
poe format # ruff format
4242
poe lint # ruff check
4343
poe typecheck # pytype --config pytype.toml (for agents-api) / pyright (for cli)
44-
poe test # ward test --exclude .venv (pytest for integrations-service)
45-
poe test --search "pattern" # Run specific tests by Ward pattern
44+
poe test # pytest (for all services)
45+
poe test -k "pattern" # Run specific tests by pytest pattern
4646
poe check # format + lint + type + SQL validation
4747
poe codegen # generate API code (e.g., OpenAPI from TypeSpec)
4848
```
@@ -186,13 +186,13 @@ async def create_entry(
186186

187187
---
188188

189-
## 9. Ward testing framework
189+
## 9. Pytest testing framework
190190

191-
* Use descriptive test names: `@test("Descriptive name of what is being tested")`.
191+
* Use descriptive test names in function names: `def test_descriptive_name_of_what_is_being_tested():`.
192192
* Activate virtual environment: `source .venv/bin/activate`.
193193
* Ensure correct working directory (e.g., `agents-api/`) and `PYTHONPATH=$PWD` for script-based tests.
194-
* Filter tests: `poe test --search "pattern_to_match"` (do NOT use `-p`).
195-
* Limit failures for faster feedback: `poe test --fail-limit 1 --search "pattern_to_match"`.
194+
* Filter tests: `poe test -k "pattern_to_match"`.
195+
* Stop on first failure for faster feedback: `poe test -x -k "pattern_to_match"`.
196196

197197
---
198198

@@ -207,7 +207,7 @@ async def create_entry(
207207

208208
## 11. Common pitfalls
209209

210-
* Mixing pytest & ward syntax (ward uses `@test()` decorator, not pytest fixtures/classes).
210+
* Forgetting to use pytest fixtures properly or mixing test framework patterns.
211211
* Forgetting to `source .venv/bin/activate`.
212212
* Wrong current working directory (CWD) or `PYTHONPATH` for commands/tests (e.g., ensure you are in `agents-api/` not root for some `agents-api` tasks).
213213
* Large AI refactors in a single commit (makes `git bisect` difficult).
@@ -258,7 +258,7 @@ This section provides pointers to important files and common patterns within the
258258
* **Execution**: The runtime instance and state of a task being performed by an agent. Core model in `typespec/executions/models.tsp`.
259259
* **POE (PoeThePoet)**: The task runner used in this project for development tasks like formatting, linting, testing, and code generation (configured in `pyproject.toml`).
260260
* **TypeSpec**: The language used to define API schemas. It is the source of truth for API models, which are then generated into Python Pydantic models in `autogen/` directories.
261-
* **Ward**: The primary Python testing framework used for unit and integration tests in most components (e.g., `agents-api`, `cli`).
261+
* **Pytest**: The primary Python testing framework used for unit and integration tests in all components.
262262
* **Temporal**: The distributed workflow engine used to orchestrate complex, long-running tasks and ensure their reliable execution.
263263
* **AIDEV-NOTE/TODO/QUESTION**: Specially formatted comments to provide inline context or tasks for AI assistants and developers.
264264

agents-api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.testmon*
12
notebooks/
23

34
# Local database files

0 commit comments

Comments
 (0)