Skip to content

Commit

Permalink
fix: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
skoob13 committed Dec 16, 2024
1 parent 667b251 commit d395b33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ee/hogai/eval/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import functools
import os
from collections.abc import Generator

import pytest
from django.conf import settings
from django.test import override_settings
from langchain_core.runnables import RunnableConfig

Expand All @@ -19,14 +19,15 @@ def retry_test_only(max_retries=3):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
last_error = None
last_error: Exception | None = None
for attempt in range(max_retries):
try:
return func(*args, **kwargs)
except Exception as e:
last_error = e
print(f"\nRetrying test (attempt {attempt + 1}/{max_retries})...") # noqa
raise last_error
if last_error:
raise last_error

return wrapper

Expand All @@ -37,7 +38,7 @@ def wrapper(*args, **kwargs):
def pytest_collection_modifyitems(items):
for item in items:
item.add_marker(
pytest.mark.skipif(os.environ.get("DEEPEVAL") != "YES", reason="Only runs for the assistant evaluation")
pytest.mark.skipif(not settings.IN_EVAL_TESTING, reason="Only runs for the assistant evaluation")
)
# Apply our custom retry decorator to the test function
item.obj = retry_test_only(max_retries=3)(item.obj)
Expand Down
2 changes: 1 addition & 1 deletion posthog/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def reset_clickhouse_tables():
""",
)
# Using `ON CLUSTER` takes x20 more time to drop the tables: https://github.com/ClickHouse/ClickHouse/issues/15473.
TABLES_TO_CREATE_DROP = +[f"DROP TABLE {table[0]}" for table in kafka_tables]
TABLES_TO_CREATE_DROP += [f"DROP TABLE {table[0]}" for table in kafka_tables]

run_clickhouse_statement_in_parallel(TABLES_TO_CREATE_DROP)

Expand Down

0 comments on commit d395b33

Please sign in to comment.