Test that requests that exceed timeout are handled with proper error.
(self)
| 336 | |
| 337 | @pytest.mark.skip(reason="This test is flaky, need to fix it") |
| 338 | def test_timeout_error(self): |
| 339 | """Test that requests that exceed timeout are handled with proper error.""" |
| 340 | |
| 341 | class App: |
| 342 | |
| 343 | def slow_method(self): |
| 344 | # Sleep longer than the timeout |
| 345 | time.sleep(2.0) |
| 346 | return "completed" |
| 347 | |
| 348 | with RpcServerWrapper(App()) as server: |
| 349 | time.sleep(0.1) |
| 350 | |
| 351 | # Create client with short timeout |
| 352 | with RPCClient(server.addr, timeout=0.5) as client: |
| 353 | with pytest.raises(RPCError) as exc_info: |
| 354 | client.slow_method().remote(timeout=0.5) |
| 355 | |
| 356 | error = exc_info.value |
| 357 | # Should be either a timeout error or RPC error indicating timeout |
| 358 | assert "timed out" in str(error).lower() or "timeout" in str( |
| 359 | error).lower() |
| 360 | |
| 361 | def test_method_not_found_error(self): |
| 362 | """Test that calling non-existent methods returns proper error.""" |
nothing calls this directly
no test coverage detected