Fix logging setup for testing

This commit is contained in:
Reinier van der Leer
2023-08-24 16:09:25 +02:00
parent bcd00b39b7
commit 4bcb39dc14
3 changed files with 7 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ def retry_api(
}
api_key_error_msg = (
f"Please double check that you have setup a "
f"{Fore.CYAN + Style.BRIGHT}PAID{Style.RESET_ALL} OpenAI API Account. You can "
f"{Style.BRIGHT}PAID{Style.NORMAL} OpenAI API Account. You can "
f"read more here: {Fore.CYAN}https://docs.agpt.co/setup/#getting-an-api-key{Fore.RESET}"
)
backoff_msg = "Waiting {backoff} seconds..."

View File

@@ -43,7 +43,7 @@ class AutoGptFormatter(logging.Formatter):
# Determine color for title
title = getattr(record, "title", "")
title_color = getattr(record, "title_color", level_color)
title_color = getattr(record, "title_color", "") or level_color
if title and title_color:
title = f"{title_color + Style.BRIGHT}{title}{Style.RESET_ALL}"
# Make sure record.title is set, and padded with a space if not empty

View File

@@ -58,7 +58,6 @@ def config(
config.plugins_config_file = temp_plugins_config_file
config.plain_output = True
configure_logging(config, Path(__file__).parent / "logs")
# avoid circular dependency
from autogpt.plugins.plugins_config import PluginsConfig
@@ -78,6 +77,11 @@ def config(
yield config
@pytest.fixture(scope="session")
def setup_logger(config: Config):
configure_logging(config, Path(__file__).parent / "logs")
@pytest.fixture()
def api_manager() -> ApiManager:
if ApiManager in ApiManager._instances: