live_server fixture + set_cookie() result in incorrect SESSION_COOKIE_DOMAIN
jvllmr opened this issue · comments
When you use the live_server fixture and set a cookie on the client you get this warning:
(Using pytest-flask 1.2.0 and flask 1.1.4)
.venv/lib/python3.9/site-packages/flask/sessions.py:208: UserWarning: "localhost" is not a valid cookie domain, it must contain a ".". Add an entry to your hosts file, for example "localhost.localdomain", and use that instead.
warnings.warn(
As a result of this, the SESSION_COOKIE_DOMAIN value of the app config is set to false instead of the intended value. It didn't make a difference in my use case but I think this is good to know.
A fix for this would be to change the default server_name to "localhost.localdomain" instead of "localhost".