Remove assumption that only us generate warnings.

In `test_max_cookie_size`, it is assumed that only Flask warnings are generated. This assumption could be broken if any of Flask dependencies or Python built-in modules produce, say, a `DeprecationWarning`. This commit asserts only what we can control.
This commit is contained in:
postmasters 2021-07-09 09:56:23 -07:00 committed by GitHub
parent 7a73171edc
commit 887d63b84f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2002,14 +2002,13 @@ def test_max_cookie_size(app, client, recwarn):
return r
client.get("/")
assert len(recwarn) == 1
w = recwarn.pop()
assert "cookie is too large" in str(w.message)
assert sum("cookie is too large" in str(w.message) for w in recwarn) == 1
app.config["MAX_COOKIE_SIZE"] = 0
recwarn.clear()
client.get("/")
assert len(recwarn) == 0
assert not any("cookie is too large" in str(w.message) for w in recwarn)
@require_cpython_gc