Browse Source

Fixed a broken test

pull/1208/head
Armin Ronacher 11 years ago
parent
commit
ddb5f9dc49
  1. 12
      flask/testsuite/basic.py

12
flask/testsuite/basic.py

@ -11,11 +11,12 @@
import re
import uuid
import time
import flask
import pickle
import unittest
from datetime import datetime
from threading import Thread, Condition
from threading import Thread
from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning
from flask._compat import text_type
from werkzeug.exceptions import BadRequest, NotFound
@ -1018,18 +1019,17 @@ class BasicFunctionalityTestCase(FlaskTestCase):
def test_before_first_request_functions_concurrent(self):
got = []
app = flask.Flask(__name__)
cv = Condition()
@app.before_first_request
def foo():
with cv:
cv.wait()
time.sleep(0.2)
got.append(42)
c = app.test_client()
def get_and_assert():
with cv:
cv.notify()
c.get("/")
self.assert_equal(got, [42])
t = Thread(target=get_and_assert)
t.start()
get_and_assert()

Loading…
Cancel
Save