Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

ci(core): run the backend tests over pytest-xdist workers

Petr Bauch119c54dfa217
diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml
index 3fd68fedb..541237a08 100644
--- a/.github/workflows/pr-ci.yml
+++ b/.github/workflows/pr-ci.yml
@@ -191,8 +191,13 @@ jobs:
# Docker so the containers come up without extra setup. The slow
# integration suite (Postgres + Tuwunel) is excluded from the default run
# and is not part of PR CI.
+ #
+ # Spread over one pytest-xdist worker per CPU. The Postgres fixture is
+ # session-scoped, and a session is per worker, so each worker boots and
+ # owns a container of its own: no test shares a database with another
+ # running at the same time.
- name: pytest
- run: uv run --project core pytest -c core/pyproject.toml core/tests/
+ run: uv run --project core pytest -c core/pyproject.toml core/tests/ -n auto
console:
name: Switch Console
diff --git a/core/pyproject.toml b/core/pyproject.toml
index 33f2aaf62..9daa19075 100644
--- a/core/pyproject.toml
+++ b/core/pyproject.toml
@@ -69,6 +69,7 @@ dev = [
"pytest>=8",
"pytest-asyncio>=0.24",
"testcontainers>=4.14.2",
+ "pytest-xdist>=3.6",
]
[tool.ruff]
diff --git a/core/uv.lock b/core/uv.lock
index b7f62ac3c..6087105bf 100644
--- a/core/uv.lock
+++ b/core/uv.lock
@@ -756,6 +756,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
]
+[[package]]
+name = "execnet"
+version = "2.1.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/bf/89/780e11f9588d9e7128a3f87788354c7946a9cbb1401ad38a48c4db9a4f07/execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd", size = 166622, upload-time = "2025-11-12T09:56:37.75Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ab/84/02fc1827e8cdded4aa65baef11296a9bbe595c474f0d6d758af082d849fd/execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec", size = 40708, upload-time = "2025-11-12T09:56:36.333Z" },
+]
+
[[package]]
name = "fastapi"
version = "0.136.1"
@@ -1958,6 +1967,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" },
]
+[[package]]
+name = "pytest-xdist"
+version = "3.8.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "execnet" },
+ { name = "pytest" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/78/b4/439b179d1ff526791eb921115fca8e44e596a13efeda518b9d845a619450/pytest_xdist-3.8.0.tar.gz", hash = "sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1", size = 88069, upload-time = "2025-07-01T13:30:59.346Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ca/31/d4e37e9e550c2b92a9cbc2e4d0b7420a27224968580b5a447f420847c975/pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88", size = 46396, upload-time = "2025-07-01T13:30:56.632Z" },
+]
+
[[package]]
name = "python-discovery"
version = "1.6.4"
@@ -2367,6 +2389,7 @@ dev = [
{ name = "pre-commit" },
{ name = "pytest" },
{ name = "pytest-asyncio" },
+ { name = "pytest-xdist" },
{ name = "ruff" },
{ name = "testcontainers" },
]
@@ -2404,6 +2427,7 @@ dev = [
{ name = "pre-commit", specifier = ">=4.5" },
{ name = "pytest", specifier = ">=8" },
{ name = "pytest-asyncio", specifier = ">=0.24" },
+ { name = "pytest-xdist", specifier = ">=3.6" },
{ name = "ruff", specifier = ">=0.15" },
{ name = "testcontainers", specifier = ">=4.14.2" },
]