: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
fix(batch-exports): Avoid logger caching (#102292)
Tomás Farías Santana60664853b75b
diff --git a/products/batch_exports/backend/tests/temporal/pipeline/test_consumer.py b/products/batch_exports/backend/tests/temporal/pipeline/test_consumer.pyindex e75cd20c117b..82679eab5e40 100644--- a/products/batch_exports/backend/tests/temporal/pipeline/test_consumer.py+++ b/products/batch_exports/backend/tests/temporal/pipeline/test_consumer.py@@ -1,4 +1,5 @@import asyncio+from collections.abc import Iteratorimport pytestfrom unittest.mock import MagicMock, patch@@ -6,6 +7,9 @@ from unittest.mock import MagicMock, patchimport pyarrow as pafrom structlog.testing import capture_logs+from posthog.temporal.common.logger import get_write_only_logger++from products.batch_exports.backend.temporal.pipeline import consumer as consumer_modulefrom products.batch_exports.backend.temporal.pipeline.consumer import Consumer, run_consumer_from_stagefrom products.batch_exports.backend.temporal.pipeline.transformer import Chunkfrom products.batch_exports.backend.temporal.queue import RecordBatchQueue@@ -13,6 +17,12 @@ from products.batch_exports.backend.temporal.queue import RecordBatchQueuepytestmark = [pytest.mark.asyncio][email protected](autouse=True, scope="module")+def fresh_consumer_logger(configure_logger_auto: None) -> Iterator[None]:+ with patch.object(consumer_module, "LOGGER", get_write_only_logger(consumer_module.__name__)):+ yield++class NoOpConsumer(Consumer):async def consume_chunk(self, data: bytes):pass