@@ -325,6 +325,48 @@ def get(self):
325
325
with pytest .raises (Exception ):
326
326
client .get ("/api/test/" )
327
327
328
+ def test_default_errorhandler_with_propagate_not_set_but_testing (self , app , client ):
329
+ blueprint = Blueprint ("api" , __name__ , url_prefix = "/api" )
330
+ api = restx .Api (blueprint )
331
+
332
+ @api .route ("/test/" )
333
+ class TestResource (restx .Resource ):
334
+ def get (self ):
335
+ raise Exception ("error" )
336
+
337
+ app .register_blueprint (blueprint )
338
+
339
+ app .config ["PROPAGATE_EXCEPTIONS" ] = None
340
+ app .testing = True
341
+
342
+ # From the Flask docs:
343
+ # PROPAGATE_EXCEPTIONS
344
+ # Exceptions are re-raised rather than being handled by the app’s error handlers.
345
+ # If not set, this is implicitly true if TESTING or DEBUG is enabled.
346
+ with pytest .raises (Exception ):
347
+ client .get ("/api/test/" )
348
+
349
+ def test_default_errorhandler_with_propagate_not_set_but_debug (self , app , client ):
350
+ blueprint = Blueprint ("api" , __name__ , url_prefix = "/api" )
351
+ api = restx .Api (blueprint )
352
+
353
+ @api .route ("/test/" )
354
+ class TestResource (restx .Resource ):
355
+ def get (self ):
356
+ raise Exception ("error" )
357
+
358
+ app .register_blueprint (blueprint )
359
+
360
+ app .config ["PROPAGATE_EXCEPTIONS" ] = None
361
+ app .debug = True
362
+
363
+ # From the Flask docs:
364
+ # PROPAGATE_EXCEPTIONS
365
+ # Exceptions are re-raised rather than being handled by the app’s error handlers.
366
+ # If not set, this is implicitly true if TESTING or DEBUG is enabled.
367
+ with pytest .raises (Exception ):
368
+ client .get ("/api/test/" )
369
+
328
370
def test_custom_default_errorhandler (self , app , client ):
329
371
api = restx .Api (app )
330
372
0 commit comments