Skip to content

Commit 7e924e2

Browse files
feat: use different port in pytest-ipywidget for differnt workers in pytest-xdist
1 parent 7647ab0 commit 7e924e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

solara/test/pytest_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535

3636
logger = logging.getLogger("solara.pytest_plugin")
3737

38-
TEST_PORT_START = int(os.environ.get("PORT", "18765")) + 100 # do not interfere with the solara integration tests
38+
39+
# support for pytest-xdist
40+
worker = os.environ.get("PYTEST_XDIST_WORKER", "gw0")
41+
# +100 so we do not interfere with the solara integration tests, +1 worker id to avoid port conflicts with other workers
42+
TEST_PORT_START = int(os.environ.get("PORT", "18765")) + int(worker[2:]) + 100
43+
3944
TEST_HOST = solara.server.settings.main.host
4045
TIMEOUT = float(os.environ.get("SOLARA_PW_TIMEOUT", "18"))
4146
PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT = int(os.environ.get("PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT", "10"))

0 commit comments

Comments
 (0)