From 2650d9350db4cf5ef2243de5fc289f7659613fcb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 25 Aug 2016 22:58:14 +0200 Subject: [PATCH] bdd: Improve webserver error on unexpected status pytest 3.0 removed the assertion reinterpretation which made this nice: https://github.com/pytest-dev/pytest/issues/1871 --- tests/end2end/fixtures/webserver.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index e7c030363..7f789cc03 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -77,7 +77,11 @@ class Request(testprocess.Line): sanitized = QUrl('http://localhost' + self.path).path() # Remove ?foo expected_statuses = path_to_statuses.get(sanitized, default_statuses) - assert self.status in expected_statuses + if self.status not in expected_statuses: + raise AssertionError( + "{} loaded with status {} but expected {}".format( + sanitized, self.status, + ' / '.join(repr(e) for e in expected_statuses))) def __eq__(self, other): return NotImplemented