-
Lets say for example, I have this test function in my pytest file, and when I run it, it is being on hold for a long time (no output no exeception): def test_upload_successful():
"""Test successful file upload scenario."""
with create_test_client(route_handlers=[upload_file]) as client:
test_content = b"test file content"
# Use proper file upload format for test client
response = client.post(
"/upload",
files={"data": ("test.txt", test_content, "text/plain")},
timeout=30
)
assert response.status_code == HTTP_201_CREATED
assert "file_path" in response.json()
assert Path("uploads/test.txt").exists() I want to see what is happening when the router is working on this test @post("/upload")
async def upload_file(
data: UploadFile = Body(media_type=RequestEncodingType.MULTI_PART, default=None)
) -> dict[str, str]: Preferably with breakpoints, how can I achieve this? (Note: I already solved the on-hold problem, I just want to know how to run test on a certain running server) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Why do you want to test against a "running server"? Is there something the Litestar test client doesn't cover? From your description, it seems like you want to debug an endpoint. You should be able to simply add a breakpoint in it. |
Beta Was this translation helpful? Give feedback.
-
Later I discovered that with the above test example, breakpoints in the app file works as usual. I just assumed it won't work without test it. Turns out to be just fine. |
Beta Was this translation helpful? Give feedback.
Later I discovered that with the above test example, breakpoints in the app file works as usual. I just assumed it won't work without test it. Turns out to be just fine.