: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): prune selected shard files in pytest (#123437)
Raúl Negrón-Otero6d07357849cc
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex de4f9935b68b..136dfe8708a4 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -3529,8 +3529,13 @@ jobs:# Scope the file-mode plan to Core's clean per-segment durations when the# pinned pytest-split supports it; only persons-on-events-off, non-compat Core# matches the .core run-set (the events_json rows do not), and a missing- # file falls back to the union.- if [ -f .test_durations.core ] && [[ "${{ matrix.person-on-events }}" != "true" ]] && [[ "${{ matrix.compat }}" != "true" ]] && [[ "$JSON_TARGETS" != "true" ]] && python -c "from pytest_split.plugin import SUPPORTS_SPLIT_PLAN_PATH" 2>/dev/null; then+ # file falls back to the union. A selected run needs a plugin that scopes+ # the plan file to its targets.+ PLAN_CAPABILITY=SUPPORTS_SPLIT_PLAN_PATH+ if [[ "$MODE" == "selected" ]]; then+ PLAN_CAPABILITY=SCOPES_SPLIT_PLAN_PATH+ fi+ if [ -f .test_durations.core ] && [[ "${{ matrix.person-on-events }}" != "true" ]] && [[ "${{ matrix.compat }}" != "true" ]] && [[ "$JSON_TARGETS" != "true" ]] && python -c "from pytest_split.plugin import $PLAN_CAPABILITY" 2>/dev/null; thenSPLIT_GRANULARITY+=(--split-plan-path .test_durations.core)fifi@@ -3597,14 +3602,10 @@ jobs:elsetargets="$CORE_FILES"fi- # A selection wide enough to need more than one shard is split like a- # full run. Item granularity on purpose: the target list is already- # narrow, so pre-import file skipping saves nothing, and the per-segment- # plan file describes a different run-set than the selected subset.SELECTED_SPLIT=()if [[ "${{ matrix.concurrency }}" -gt 1 ]]; thenSELECTED_SPLIT=(--splits "${{ matrix.concurrency }}" --group "${{ matrix.group }}"- --splitting-algorithm="$SPLITTING_ALGORITHM")+ --splitting-algorithm="$SPLITTING_ALGORITHM" "${SPLIT_GRANULARITY[@]}")fi# shellcheck disable=SC2086pytest -v --tb=short --reuse-db -o junit_duration_report=call $targets -m "not async_migrations" \@@ -3708,14 +3709,10 @@ jobs:# The --deselect guards stay on both branches so a selected run can't re-enable them.if [[ "$MODE" == "selected" ]]; then# Selected mode uses the same single-retry budget as the full run.- # A selection wide enough to need more than one shard is split like a- # full run. Item granularity on purpose: the target list is already- # narrow, so pre-import file skipping saves nothing, and the per-segment- # plan file describes a different run-set than the selected subset.SELECTED_SPLIT=()if [[ "${{ matrix.concurrency }}" -gt 1 ]]; thenSELECTED_SPLIT=(--splits "${{ matrix.concurrency }}" --group "${{ matrix.group }}"- --splitting-algorithm="$SPLITTING_ALGORITHM")+ --splitting-algorithm="$SPLITTING_ALGORITHM" "${SPLIT_GRANULARITY[@]}")fi# shellcheck disable=SC2086pytest -v --tb=short --reuse-db -o junit_duration_report=call $TEMPORAL_FILES -m "not async_migrations" \diff --git a/pyproject.toml b/pyproject.tomlindex ca6884e22660..deed5e7844c7 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -347,9 +347,9 @@ personhog-proto = { workspace = true }infi-clickhouse-orm = { git = "https://github.com/PostHog/infi.clickhouse_orm", rev = "fa20b806e32cf748dfee3545d8926b9c36aff789" }# pytest-split: pinned to PostHog's fork (immutable tag) for the order-preserving# optimal_chunks split. Fork: PostHog/pytest-split (of jerry-git/pytest-split).-# To pull upstream fixes: rebase the fork's feat branch onto upstream, cut the next-# v0.11.0-posthog.N tag, and bump this pin.-pytest-split = { git = "https://github.com/PostHog/pytest-split", tag = "v0.11.0-posthog.8" }+# Base future upstream rebases on the pinned tag so local fixes survive.+# Cut the next v0.11.0-posthog.N tag and bump this pin.+pytest-split = { git = "https://github.com/PostHog/pytest-split", tag = "v0.11.0-posthog.13" }torch = [{ index = "pytorch-cpu", group = "inbox-ranking" }]# xgboost's Linux wheel declares nvidia-nccl-cu12 (322 MB) for multi-GPU training. We use xgboost ondiff --git a/uv.lock b/uv.lockindex c83253f2bf54..1a71131d50c0 100644--- a/uv.lock+++ b/uv.lock@@ -6419,7 +6419,7 @@ dev = [{ name = "pytest-icdiff", specifier = "~=0.9" },{ name = "pytest-mock", specifier = "~=3.15.1" },{ name = "pytest-rerunfailures", specifier = "==16.6" },- { name = "pytest-split", git = "https://github.com/PostHog/pytest-split?tag=v0.11.0-posthog.8" },+ { name = "pytest-split", git = "https://github.com/PostHog/pytest-split?tag=v0.11.0-posthog.13" },{ name = "pytest-timeout", specifier = "~=2.4.0" },{ name = "pytest-xdist", specifier = "~=3.8.0" },{ name = "python-dateutil", specifier = "~=2.9.0" },@@ -7264,7 +7264,7 @@ wheels = [[[package]]name = "pytest-split"version = "0.11.0"-source = { git = "https://github.com/PostHog/pytest-split?tag=v0.11.0-posthog.8#559e2197cbb36b99810d95cf470aba4e69910776" }+source = { git = "https://github.com/PostHog/pytest-split?tag=v0.11.0-posthog.13#9ce92c24e642acfba8b4dde5b49a050ab7a104b6" }dependencies = [{ name = "pytest" },]