Skip to content
Myr

fix issue #879 and add a test for it

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alexis Svinartchouk · committed by Armin Ronacher · parent 964c4a3 · Browse files · 2 files+19 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>

Diff stats

2 files+19 added−1 removed

  • other:+19 added−1 removed

2 files+19 added−1 removed

modified:flask/testsuite/basic.py+18 added
14 unmodified lines
15import pickle16import unittest17from datetime import datetime18from threading import Thread19from time import sleep20from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning21from flask._compat import text_type22from werkzeug.exceptions import BadRequest, NotFound23from werkzeug.http import parse_date
991 unmodified lines
1015 c.get('/')1016 self.assert_equal(got, [42])1017 self.assert_true(app.got_first_request)10181019 def test_before_first_request_functions_concurrent(self):1020 got = []1021 app = flask.Flask(__name__)1022 @app.before_first_request1023 def foo():1024 sleep(1)1025 got.append(42)1026 c = app.test_client()1027 def get_and_assert():1028 c.get("/")1029 self.assert_equal(got, [42])1030 t = Thread(target=get_and_assert)1031 t.start()1032 get_and_assert()1033 t.join()1034 self.assert_true(app.got_first_request)10351036 def test_routing_redirect_debugging(self):1037 app = flask.Flask(__name__)1038 app.debug = True1039 @app.route('/foo/', methods=['GET', 'POST'])
233 unmodified lines
modified:flask/app.py+1 added-1 removed
1490 unmodified lines
1491 return1492 with self._before_request_lock:1493 if self._got_first_request:1494 return1495 self._got_first_request = True1495 for func in self.before_first_request_funcs:1496 func()1497 self._got_first_request = True14981499 def make_default_options_response(self):1500 """This method is called to create the default `OPTIONS` response.1501 This can be changed through subclassing to change the default
341 unmodified lines