add punkreq dependency and implement performance tests for publish API - #18
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an HTTP client dependency and introduces pytest-based checks intended to exercise the /publish FastAPI endpoint, including a sustained-throughput test.
Changes:
- Add
punkreqas a dependency and updateuv.lockaccordingly. - Add a new
devdependency group withpytest. - Introduce async pytest tests that call the running
/publishAPI, including a 10-second sustained load loop.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
uv.lock |
Locks new runtime/dev dependencies (punkreq, pytest, and transitive deps). |
tests/test_publish_api.py |
Adds async integration/performance-style tests targeting /publish. |
pyproject.toml |
Adds punkreq to runtime deps and introduces a dev dependency group with pytest. |
Suppressed comments (1)
tests/test_publish_api.py:19
- This is a 10-second sustained load test in the normal pytest suite, and will make
pytestslow/flaky (and still requires an externally running API). It should be skipped by default unless explicitly enabled (or moved under a separate perf/bench harness).
@pytest.mark.anyio
async def test_publish_sustained_maximum_speed_for_10_seconds():
duration = 10.0
async with Client(base_url="http://0.0.0.0:8080") as client:
start = time.perf_counter()
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
10
to
14
| dependencies = [ | ||
| "fastapi[all]>=0.141.1", | ||
| "faust-streaming[ckafka,fast]==0.13.0", | ||
| "punkreq>=0.1.1", | ||
| "ruff>=0.16.1", |
Comment on lines
+9
to
+12
| async def test_publish(): | ||
| async with Client(base_url="http://0.0.0.0:8080") as client: | ||
| response = await client.post("/publish", json={"message": f"random: {random.random()!s}"}) | ||
| response.raise_for_status() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.