diff options
author | toofar <toofar@spalge.com> | 2022-08-18 19:18:09 +1200 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2022-08-18 19:18:09 +1200 |
commit | d6b7d51307e08fa64c9acd2ed02eca876a1eec6d (patch) | |
tree | acdc97d0ff893757a4ee3d81e2f0404ec004d1f1 | |
parent | b731fb49d761035888c9ee0b34125de6efda6c37 (diff) | |
download | qutebrowser-d6b7d51307e08fa64c9acd2ed02eca876a1eec6d.tar.gz qutebrowser-d6b7d51307e08fa64c9acd2ed02eca876a1eec6d.zip |
Ignore flask development warnings.
We used to dodge these by listening on 0.0.0.0. Now they are on to us
and always show the warnings. Running flask in development mode here is
intended, so lets not have the warnings fail the tests.
Ref: https://github.com/pallets/werkzeug/issues/2480
-rw-r--r-- | tests/end2end/fixtures/webserver.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index 2c2eab930..653bbf880 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -31,6 +31,7 @@ import pytest from PyQt5.QtCore import pyqtSignal, QUrl from end2end.fixtures import testprocess +from helpers import testutils class Request(testprocess.Line): @@ -125,6 +126,18 @@ class ExpectedRequest: return NotImplemented +def is_flask_development_message(message): + ignored_messages = [ + ("WARNING: This is a development server. Do not use it in a production " + "deployment. Use a production WSGI server instead."), + "Press CTRL+C to quit", + ] + return any( + testutils.pattern_match(pattern=pattern, value=message) + for pattern in ignored_messages + ) + + class WebserverProcess(testprocess.Process): """Abstraction over a running Flask server process. @@ -160,8 +173,12 @@ class WebserverProcess(testprocess.Process): def _parse_line(self, line): self._log(line) - started_re = re.compile(r' \* Running on https?://127\.0\.0\.1:{}/? ' - r'\(Press CTRL\+C to quit\)'.format(self.port)) + + if is_flask_development_message(line): + return None + + started_re = re.compile(r' \* Running on https?://127\.0\.0\.1:{}/?' + r'( \(Press CTRL\+C to quit\))?'.format(self.port)) if started_re.fullmatch(line): self.ready.emit() return None |