Projet

Général

Profil

0003-tests-allow-exceptions-to-backtrace-into-tests.patch

Benjamin Dauvergne, 22 février 2021 23:53

Télécharger (1,6 ko)

Voir les différences:

Subject: [PATCH 3/3] tests: allow exceptions to backtrace into tests

 tests/conftest.py       | 4 ++++
 wcs/qommon/publisher.py | 6 ++++++
 2 files changed, 10 insertions(+)
tests/conftest.py
3 3

  
4 4
import pytest
5 5

  
6
import wcs.qommon.publisher
7

  
6 8
from utilities import EmailsMocking, SMSMocking, HttpRequestsMocking
7 9

  
10
wcs.qommon.publisher.intercept_exceptions = False
11

  
8 12

  
9 13
def site_options(request, pub, section, variable, value):
10 14
    config = ConfigParser.ConfigParser()
wcs/qommon/publisher.py
65 65
from .vendor import locket
66 66

  
67 67

  
68
intercept_exceptions = True
69

  
70

  
68 71
class ImmediateRedirectException(Exception):
69 72
    def __init__(self, location):
70 73
        self.location = location
......
272 275

  
273 276
        (exc_type, exc_value, tb) = sys.exc_info()
274 277

  
278
        if not intercept_exceptions:
279
            raise
280

  
275 281
        if exc_type is NotImplementedError:
276 282
            get_response().set_header('Content-Type', 'text/html')  # set back content-type
277 283
            return template.error_page(_('This feature is not yet implemented.'), error_title=_('Sorry'))
278
-