-
Notifications
You must be signed in to change notification settings - Fork 109
Closed
Description
This isn't a bug in LiveServerTestCase itself but with running the flask application using wekzeug with multiprocessing when the use_reloader option set to true. It can be reproduced with the following snippet
import unittest
import multiprocessing
import flask
import time
import random
class FlaskAppMultiProcTest(unittest.TestCase):
def runTest(self):
app = flask.Flask(__name__)
proc = multiprocessing.Process(target=app.run
, kwargs = {"use_reloader":True})
proc.start()
time.sleep(1)
proc.terminate()
if __name__ == "__main__":
unittest.main()
- Changing
use_reloader
toFalse
results in single execution. - Running the above sample will show output from the double execution.
- Replacing
unittest.main()
withFlaskAppMultiProcTest().runTest()
will also result in double execution. - Running the test with nosetests also results in double execution.
Metadata
Metadata
Assignees
Labels
No labels