Skip to content

Commit 8e4b599

Browse files
committed
Move application worker definition to the top level of a module
As per https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled the only top level function can be pickled. Re #54.
1 parent 5048d0c commit 8e4b599

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: pytest_flask/fixtures.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def test_login(self):
4141
request.cls.client = client
4242

4343

44+
def _app_worker(app, port):
45+
app.run(port=port, use_reloader=False)
46+
47+
4448
class LiveServer(object):
4549
"""The helper class uses to manage live server. Handles creation and
4650
stopping application in a separate process.
@@ -56,10 +60,8 @@ def __init__(self, app, port):
5660

5761
def start(self):
5862
"""Start application in a separate process."""
59-
def worker(app, port):
60-
app.run(port=port, use_reloader=False)
6163
self._process = multiprocessing.Process(
62-
target=worker,
64+
target=_app_worker,
6365
args=(self.app, self.port)
6466
)
6567
self._process.start()

0 commit comments

Comments
 (0)