Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fix logging setup for testing

Reinier van der Leer4bcb39dc1445
diff --git a/autogpt/llm/providers/openai.py b/autogpt/llm/providers/openai.py
index d4c2b15f87..433e5b7b1f 100644
--- a/autogpt/llm/providers/openai.py
+++ b/autogpt/llm/providers/openai.py
@@ -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..."
diff --git a/autogpt/logs/formatters.py b/autogpt/logs/formatters.py
index 84f14d86a1..2c05f83122 100644
--- a/autogpt/logs/formatters.py
+++ b/autogpt/logs/formatters.py
@@ -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
diff --git a/tests/conftest.py b/tests/conftest.py
index 21dc900c01..55a1a4e3fa 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -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
[email protected](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: