Skip to content
Myr

fix pytest 7 warnings

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 6f7d99c · Browse files · 2 files+16 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−4 removed

  • tests:+16 added−4 removed

2 files+16 added−4 removed

modified:tests/test_basic.py+10 added-3 removed
1 unmodified line
2import re3import sys4import time5import uuid6import warnings7import weakref8from datetime import datetime9from platform import python_implementation10from threading import Thread
1516 unmodified lines
1527 app.config["SERVER_NAME"] = "dev.local"1528 rv = client.get("/", "https://dev.local")1529 assert rv.data == b"default"15301530 # suppress Werkzeug 1.0 warning about name mismatch1531 with pytest.warns(None):1531 # suppress Werkzeug 0.15 warning about name mismatch1532 with warnings.catch_warnings():1533 warnings.filterwarnings(1534 "ignore", "Current server name", UserWarning, "flask.app"1535 )1536 rv = client.get("/", "http://foo.localhost")1537 assert rv.status_code == 40415381539 rv = client.get("/", "http://foo.dev.local")
358 unmodified lines
1898 def index():1899 return "", 20419001901 # suppress Werkzeug 0.15 warning about name mismatch1898 with pytest.warns(None):1902 with warnings.catch_warnings():1903 warnings.filterwarnings(1904 "ignore", "Current server name", UserWarning, "flask.app"1905 )1906 # ip address can't match name1907 rv = client.get("/", "http://127.0.0.1:3000/")1908 assert rv.status_code == 404 if matching else 2041909
126 unmodified lines
modified:tests/test_reqctx.py+6 added-1 removed
1import warnings23import pytest45import flask6from flask.sessions import SecureCookieSessionInterface
75 unmodified lines
82 == "http://foo.localhost.localdomain:5000/"83 )8485 # suppress Werkzeug 0.15 warning about name mismatch84 with pytest.warns(None):86 with warnings.catch_warnings():87 warnings.filterwarnings(88 "ignore", "Current server name", UserWarning, "flask.app"89 )90 with app.test_request_context(91 "/", environ_overrides={"HTTP_HOST": "localhost"}92 ):93 pass
232 unmodified lines