From 09b6933032a86dbb4b1f18307cedf41f061afc3e Mon Sep 17 00:00:00 2001 From: Sandy Spicer Date: Wed, 5 Jun 2024 12:32:02 -0700 Subject: [PATCH] feat(dev): add xdist for local concurrency in pytest (#22684) --- bin/tests | 9 +- docker/clickhouse/config.xml | 2 +- ee/clickhouse/materialized_columns/columns.py | 10 +- .../test/test_trends_data_warehouse_query.py | 3 +- posthog/settings/data_stores.py | 26 ++- posthog/test/base.py | 21 ++- requirements-dev.in | 1 + requirements-dev.txt | 154 +++++++++++++++--- 8 files changed, 184 insertions(+), 42 deletions(-) diff --git a/bin/tests b/bin/tests index 21120dbc3fb..395f01c519a 100755 --- a/bin/tests +++ b/bin/tests @@ -30,4 +30,11 @@ PG_PASSWORD="${PGPASSWORD:=posthog}" PG_PORT="${PGPORT:=5432}" PGOPTIONS='--client-min-messages=warning' psql posthog -d "postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}" -c "drop database if exists test_posthog" 1> /dev/null -nodemon -w ./posthog -w ./hogvm/python -w ./ee --ext py --exec "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES pytest --reuse-db --durations-min=2.0 ${MIGRATIONS} -s $* --snapshot-update; mypy -p posthog | mypy-baseline filter" +if [ -z "$XDIST_WORKERS" ] +then + TEST_CONCURRENCY="" +else + TEST_CONCURRENCY="-n $XDIST_WORKERS" +fi + +nodemon -w ./posthog -w ./hogvm/python -w ./ee --ext py --exec "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES pytest --reuse-db --durations-min=2.0 ${MIGRATIONS} ${TEST_CONCURRENCY} -s $* --snapshot-update; mypy -p posthog | mypy-baseline filter" \ No newline at end of file diff --git a/docker/clickhouse/config.xml b/docker/clickhouse/config.xml index 8a6c12eac00..bc1c691f8b4 100644 --- a/docker/clickhouse/config.xml +++ b/docker/clickhouse/config.xml @@ -285,7 +285,7 @@ --> - 100 + 200