(app, client)
| 243 | |
| 244 | |
| 245 | def test_init_once(app, client): |
| 246 | n = 0 |
| 247 | |
| 248 | class CountInit(flask.views.View): |
| 249 | init_every_request = False |
| 250 | |
| 251 | def __init__(self): |
| 252 | nonlocal n |
| 253 | n += 1 |
| 254 | |
| 255 | def dispatch_request(self): |
| 256 | return str(n) |
| 257 | |
| 258 | app.add_url_rule("/", view_func=CountInit.as_view("index")) |
| 259 | assert client.get("/").data == b"1" |
| 260 | assert client.get("/").data == b"1" |
nothing calls this directly
no test coverage detected