Skip to content

Commit b298256

Browse files
author
byron
committed
💥 needs more flexible for the arguments, hard to tune waitress with debug mode
1 parent 0958110 commit b298256

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Diff for: dash/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Added
44

5-
- [#918](https://github.com/plotly/dash/pull/918) Adds `wait_for_element_by_id` and `visit_and_snapshot` APIs, adds optional `start_timeout` argument for process runner
5+
- 💥 [#918](https://github.com/plotly/dash/pull/918) Adds `wait_for_element_by_id` and `visit_and_snapshot` APIs, change the process command options and adds optional `start_timeout` argument for process runner
66

77
### Fixed
88

Diff for: dash/testing/application_runners.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,25 @@ def __init__(self, keep_open=False, stop_timeout=3):
180180

181181
# pylint: disable=arguments-differ
182182
def start(
183-
self, app_module, application_name="app", port=8050, start_timeout=3
183+
self, waitress_module=None, raw_command=None, port=8050, start_timeout=3
184184
):
185185
"""Start the server with waitress-serve in process flavor """
186-
entrypoint = "{}:{}.server".format(app_module, application_name)
186+
if not (waitress_module or raw_command): # need to set a least one
187+
logging.error(
188+
"the process runner needs to start with"
189+
" at least one valid command"
190+
)
191+
return
187192
self.port = port
188-
189193
args = shlex.split(
190-
"waitress-serve --listen=0.0.0.0:{} {}".format(port, entrypoint),
194+
raw_command
195+
if raw_command
196+
else "waitress-serve --listen=0.0.0.0:{} {}".format(
197+
port, waitress_module
198+
),
191199
posix=not self.is_windows,
192200
)
201+
193202
logger.debug("start dash process with %s", args)
194203

195204
try:

Diff for: tests/unit/test_app_runners.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_threaded_server_smoke(dash_thread_server):
2525
sys.version_info < (3,), reason="requires python3 for process testing"
2626
)
2727
def test_process_server_smoke(dash_process_server):
28-
dash_process_server("simple_app")
28+
dash_process_server(waitress_module="simple_app:app.server")
2929
r = requests.get(dash_process_server.url)
3030
assert r.status_code == 200, "the server is reachable"
3131
assert 'id="react-entry-point"' in r.text, "the entrypoint is present"

0 commit comments

Comments
 (0)