forked from orbit-oss/flask
fix tests failing with server name warnings
After pallets/werkzeug#1577, mismatched configured and real server names will show a warning in addition to raising 404. This caused tests that did this deliberately to fail. This patch removes the pytest fixture we were using to fail on warnings, instead using the standard `-Werror` option. This speeds up the tests by ~3x.
This commit is contained in:
parent
6369537a49
commit
dbd4520ccb
5 changed files with 37 additions and 63 deletions
|
|
@ -88,15 +88,10 @@ def test_proper_test_request_context(app):
|
|||
assert flask.url_for('sub', _external=True) == \
|
||||
'http://foo.localhost.localdomain:5000/'
|
||||
|
||||
try:
|
||||
# suppress Werkzeug 0.15 warning about name mismatch
|
||||
with pytest.warns(None):
|
||||
with app.test_request_context('/', environ_overrides={'HTTP_HOST': 'localhost'}):
|
||||
pass
|
||||
except ValueError as e:
|
||||
assert str(e) == (
|
||||
"the server name provided "
|
||||
"('localhost.localdomain:5000') does not match the "
|
||||
"server name from the WSGI environment ('localhost')"
|
||||
)
|
||||
|
||||
app.config.update(SERVER_NAME='localhost')
|
||||
with app.test_request_context('/', environ_overrides={'SERVER_NAME': 'localhost'}):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue