Performance: Test client for request simulation
MEDIUM IMPACT
This affects backend testing speed and resource usage by simulating HTTP requests without network overhead.
from flask import Flask app = Flask(__name__) with app.test_client() as client: response = client.get('/api/data') print(response.status_code)
import requests response = requests.get('http://localhost:5000/api/data') print(response.status_code)
| Pattern | Network Calls | Server Dependency | Test Speed | Verdict |
|---|---|---|---|---|
| Real HTTP requests with requests library | Yes | Requires running server | Slow due to network latency | [X] Bad |
| Flask test client in-process requests | No | No server needed | Fast, immediate response | [OK] Good |