:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ci): add pytest-durations phase timing to django shards (#60535)
Raúl Negrón-Oteroa9c799c02796
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 3245715702ca..452ff3d50fe4 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -1754,6 +1754,7 @@ jobs:${{ matrix.person-on-events && '--ignore=posthog/hogql' || '' }} \--splits ${{ matrix.concurrency }} --group ${{ matrix.group }} \--durations=1000 --durations-min=1.0 --store-durations \+ --pytest-durations=100 \--splitting-algorithm=duration_based_chunks \--reruns 2 --reruns-delay 1 \-r fEsxX \@@ -1814,6 +1815,7 @@ jobs:pytest -v --tb=short --reuse-db -o junit_duration_report=call posthog/temporal products/batch_exports/backend/tests/temporal products/tasks/backend/temporal -m "not async_migrations" \--splits ${{ matrix.concurrency }} --group ${{ matrix.group }} \--durations=100 --durations-min=1.0 --store-durations \+ --pytest-durations=100 \--splitting-algorithm=duration_based_chunks \--reruns 2 --reruns-delay 1 \-r fEsxX \diff --git a/pyproject.toml b/pyproject.tomlindex 02d37a8386f3..62e7ed4a4f2d 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -238,6 +238,7 @@ dev = ["pytest-aiohttp~=1.1.0","pytest-cov~=7.0.0","pytest-django~=4.11.1",+ "pytest-durations~=1.6.2","pytest-env~=1.2.0","pytest-icdiff~=0.9","pytest-mock~=3.15.1",diff --git a/pytest.ini b/pytest.iniindex fcc7f62bcf77..9b1442b4ada2 100644--- a/pytest.ini+++ b/pytest.ini@@ -4,7 +4,8 @@ env =DEBUG=1TEST=1DJANGO_SETTINGS_MODULE = posthog.settings-addopts = -p no:warnings --reuse-db --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/traffic-sim+# --pytest-durations=0 disables the pytest-durations plugin by default; CI shard steps re-enable it explicitly+addopts = -p no:warnings --reuse-db --pytest-durations=0 --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/traffic-simmarkers =eediff --git a/uv.lock b/uv.lockindex aa496932c30a..7bc4abc72b7b 100644--- a/uv.lock+++ b/uv.lock@@ -5440,6 +5440,7 @@ dev = [{ name = "pytest-asyncio" },{ name = "pytest-cov" },{ name = "pytest-django" },+ { name = "pytest-durations" },{ name = "pytest-env" },{ name = "pytest-icdiff" },{ name = "pytest-mock" },@@ -5706,6 +5707,7 @@ dev = [{ name = "pytest-asyncio", specifier = "~=1.3.0" },{ name = "pytest-cov", specifier = "~=7.0.0" },{ name = "pytest-django", specifier = "~=4.11.1" },+ { name = "pytest-durations", specifier = "~=1.6.2" },{ name = "pytest-env", specifier = "~=1.2.0" },{ name = "pytest-icdiff", specifier = "~=0.9" },{ name = "pytest-mock", specifier = "~=3.15.1" },@@ -6422,6 +6424,18 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/be/ac/bd0608d229ec808e51a21044f3f2f27b9a37e7a0ebaca7247882e67876af/pytest_django-4.11.1-py3-none-any.whl", hash = "sha256:1b63773f648aa3d8541000c26929c1ea63934be1cfa674c76436966d73fe6a10", size = 25281, upload-time = "2025-04-03T18:56:07.678Z" },]+[[package]]+name = "pytest-durations"+version = "1.6.2"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "pytest" },+]+sdist = { url = "https://files.pythonhosted.org/packages/be/90/fc7a8b7ed69ab4f8b9f08940afcc909085b7f5ae8530335829ad7e45814e/pytest_durations-1.6.2.tar.gz", hash = "sha256:7b197199251b16da06f6facd1ed66922438e732e555b7528e9bfa94a5f361d02", size = 12829, upload-time = "2026-03-13T15:30:30.851Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/a3/8c/470f3732de17b99519abedc71b127e1c10f85a7ac1a62332f61d4f908cc2/pytest_durations-1.6.2-py3-none-any.whl", hash = "sha256:4f5c05367858be9251f170a627695f56680456aa583ce041e6246977b55a89b6", size = 14423, upload-time = "2026-03-13T15:30:29.703Z" },+]+[[package]]name = "pytest-env"version = "1.2.0"