Merge branch '0.10-maintenance'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Daniel Neuhäuser · committed by Daniel Neuhäuser · parents 544118b, a3a2f52 · Browse files · 4 files·+40 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+40 added−0 removed
- other:+40 added−0 removed
Provenance
- Commit
b63a992- Tree
029a71f- Author
Daniel Neuhäuser <dasdasich@gmail.com>- Committer
Daniel Neuhäuser <dasdasich@gmail.com>- Parent 1
544118b- Parent 2
a3a2f52
4 files changed+40 added−0 removed
modified:flask/testsuite/appctx.py+17 added
61 unmodified lines62 pass63 64 self.assert_equal(cleanup_stuff, [None])65 66+ def test_app_tearing_down_with_previous_exception(self):67+ cleanup_stuff = []68+ app = flask.Flask(__name__)69+ @app.teardown_appcontext70+ def cleanup(exception):71+ cleanup_stuff.append(exception)72+73+ try:74+ raise Exception('dummy')75+ except Exception:76+ pass77+78+ with app.app_context():79+ pass80+81+ self.assert_equal(cleanup_stuff, [None])82+83 def test_custom_app_ctx_globals_class(self):84 class CustomRequestGlobals(object):85 def __init__(self):86 self.spam = 'eggs'32 unmodified linesmodified:flask/testsuite/reqctx.py+16 added
31 unmodified lines32 self.assert_equal(buffer, [])33 ctx.pop()34 self.assert_equal(buffer, [None])35 36+ def test_teardown_with_previous_exception(self):37+ buffer = []38+ app = flask.Flask(__name__)39+ @app.teardown_request40+ def end_of_request(exception):41+ buffer.append(exception)42+43+ try:44+ raise Exception('dummy')45+ except Exception:46+ pass47+48+ with app.test_request_context():49+ self.assert_equal(buffer, [])50+ self.assert_equal(buffer, [None])51+52 def test_proper_test_request_context(self):53 app = flask.Flask(__name__)54 app.config.update(55 SERVER_NAME='localhost.localdomain:5000'146 unmodified linesmodified:flask/ctx.py+5 added
161 unmodified lines162 163 def push(self):164 """Binds the app context to the current context."""165 self._refcnt += 1166+ if hasattr(sys, 'exc_clear'):167+ sys.exc_clear()168 _app_ctx_stack.push(self)169 appcontext_pushed.send(self.app)170 171 def pop(self, exc=None):141 unmodified lines313 self._implicit_app_ctx_stack.append(app_ctx)314 else:315 self._implicit_app_ctx_stack.append(None)316 317+ if hasattr(sys, 'exc_clear'):318+ sys.exc_clear()319+320 _request_ctx_stack.push(self)321 322 # Open the session at the moment that the request context is323 # available. This allows a custom open_session method to use the76 unmodified linesmodified:CHANGES+2 added
22 unmodified lines23 - Fixed broken `test_appcontext_signals()` test case.24 - Raise an :exc:`AttributeError` in :func:`flask.helpers.find_package` with a25 useful message explaining why it is raised when a PEP 302 import hook is used26 without an `is_package()` method.27+- Fixed an issue causing exceptions raised before entering a request or app28+ context to be passed to teardown handlers.29 30 Version 0.10.131 --------------32 457 unmodified lines