comparison tests/conftest.py @ 786:97c1dc568810

tests: Fix crash when reporting 404 errors during server tests.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 01 Sep 2016 22:58:31 -0700
parents 982de61e7da9
children 276030ea7972
comparison
equal deleted inserted replaced
785:661f7ba15762 786:97c1dc568810
416 def repr_failure(self, excinfo): 416 def repr_failure(self, excinfo):
417 from piecrust.serving.server import MultipleNotFound 417 from piecrust.serving.server import MultipleNotFound
418 if isinstance(excinfo.value, MultipleNotFound): 418 if isinstance(excinfo.value, MultipleNotFound):
419 res = '\n'.join( 419 res = '\n'.join(
420 ["HTTP error 404 returned:", 420 ["HTTP error 404 returned:",
421 excinfo.value.description] + 421 str(excinfo.value)] +
422 [e.description for e in excinfo.value._nfes]) 422 [str(e) for e in excinfo.value._nfes])
423 res += repr_nested_failure(excinfo) 423 res += repr_nested_failure(excinfo)
424 return res 424 return res
425 elif isinstance(excinfo.value, HTTPException): 425 elif isinstance(excinfo.value, HTTPException):
426 res = '\n'.join( 426 res = '\n'.join(
427 ["HTTP error %s returned:" % excinfo.value.code, 427 ["HTTP error %s returned:" % excinfo.value.code,