Skip to content

Commit d0e2e7b

Browse files
Diggseyuntitaker
authored andcommitted
Add test and changes
1 parent 12c49c7 commit d0e2e7b

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

CHANGES

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ Flask Changelog
33

44
Here you can see the full list of changes between each Flask release.
55

6+
Version 0.13
7+
------------
8+
9+
Major release, unreleased
10+
11+
- Make `app.run()` into a noop if a Flask application is run from the
12+
development server on the command line. This avoids some behavior that
13+
was confusing to debug for newcomers.
14+
- Change default configuration `JSONIFY_PRETTYPRINT_REGULAR=False`. jsonify()
15+
method returns compressed response by default, and pretty response in
16+
debug mode.
17+
- Call `ctx.auto_pop` with the exception object instead of `None`, in the
18+
event that a `BaseException` such as `KeyboardInterrupt` is raised in a
19+
request handler.
20+
621
Version 0.12.1
722
--------------
823

tests/test_basic.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,26 @@ def after_request(resp):
791791
assert resp.data == b'internal server error'
792792

793793

794+
def test_baseexception_error_handling():
795+
app = flask.Flask(__name__)
796+
app.config['LOGGER_HANDLER_POLICY'] = 'never'
797+
798+
@app.route('/')
799+
def broken_func():
800+
raise KeyboardInterrupt()
801+
802+
with app.test_client() as c:
803+
try:
804+
c.get('/')
805+
raise AssertionError("KeyboardInterrupt should have been raised")
806+
except KeyboardInterrupt:
807+
pass
808+
809+
ctx = flask._request_ctx_stack.top
810+
assert ctx.preserved
811+
assert type(ctx._preserved_exc) is KeyboardInterrupt
812+
813+
794814
def test_before_request_and_routing_errors():
795815
app = flask.Flask(__name__)
796816

0 commit comments

Comments
 (0)