Environment methods

This commit is contained in:
2025-08-23 19:01:36 +01:00
parent cba9d1e341
commit 2a85845835
146 changed files with 370 additions and 383 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -2,7 +2,7 @@ import os
from typing import Dict, Optional, Any, TypedDict, List
from supabase import create_client, Client
from supabase.lib.client_options import SyncClientOptions
from gotrue import SyncMemoryStorage
from supabase_auth import SyncMemoryStorage
from modules.logger_tool import initialise_logger
logger = initialise_logger(__name__, os.getenv("LOG_LEVEL"), os.getenv("LOG_PATH"), 'default', True)
+21 -12
View File
@@ -2,7 +2,11 @@ import os
import sys
import logging
import datetime
import pytest
try:
import pytest
PYTEST_AVAILABLE = True
except ImportError:
PYTEST_AVAILABLE = False
from dotenv import load_dotenv, find_dotenv
# Load environment variables
@@ -86,17 +90,22 @@ class FileFormatter(logging.Formatter):
return logging.Formatter(LOG_FORMAT).format(record)
class PytestFormatter:
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(self, item, call):
outcome = yield
report = outcome.get_result()
if report.when == "call":
if report.passed:
logging.success(f"✅ Test passed: {item.name}")
elif report.failed:
logging.error(f"❌ Test failed: {item.name}")
elif report.skipped:
logging.warning(f"⏭️ Test skipped: {item.name}")
if PYTEST_AVAILABLE:
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(self, item, call):
outcome = yield
report = outcome.get_result()
if report.when == "call":
if report.passed:
logging.success(f"✅ Test passed: {item.name}")
elif report.failed:
logging.error(f"❌ Test failed: {item.name}")
elif report.skipped:
logging.warning(f"⏭️ Test skipped: {item.name}")
else:
# Dummy implementation when pytest is not available
def pytest_runtest_makereport(self, item, call):
pass
# Custom logger methods
def _add_custom_log_methods():