From 77984d18d387abf38e5f7bd80348315d27380cf8 Mon Sep 17 00:00:00 2001 From: philippe Date: Mon, 11 Apr 2022 11:44:50 -0400 Subject: [PATCH] Use dynamic port range if no port specified. --- dash/testing/application_runners.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dash/testing/application_runners.py b/dash/testing/application_runners.py index 113f2be1ed..362a1898b7 100644 --- a/dash/testing/application_runners.py +++ b/dash/testing/application_runners.py @@ -50,6 +50,8 @@ def import_app(app_file, application_name="app"): class BaseDashRunner: """Base context manager class for running applications.""" + _next_port = 58050 + def __init__(self, keep_open, stop_timeout): self.port = 8050 self.started = None @@ -148,7 +150,8 @@ def run(): app.scripts.config.serve_locally = True app.css.config.serve_locally = True if "port" not in kwargs: - kwargs["port"] = self.port + kwargs["port"] = self.port = BaseDashRunner._next_port + BaseDashRunner._next_port += 1 else: self.port = kwargs["port"]