diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index fb4a0063..0ceb64d5 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -1,3 +1,4 @@ +import os import unittest import warnings from unittest import TestCase @@ -7,22 +8,42 @@ class TestCLI(TestCase): def test_cli_1(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/nlp-classroom.json") arena.launch_cli(max_steps=10, interactive=False) def test_cli_2(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/chameleon.json") arena.launch_cli(max_steps=10, interactive=False) def test_cli_3(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/tic-tac-toe.json") arena.launch_cli(max_steps=10, interactive=False) def test_cli_4(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/rock-paper-scissors.json") arena.launch_cli(max_steps=10, interactive=False) def test_cli_5(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/nlp-classroom-3players.json") arena.launch_cli(max_steps=10, interactive=False) @@ -31,8 +52,11 @@ def test_cli_6(self): arena = Arena.from_config("examples/pettingzoo_chess.json") arena.launch_cli(max_steps=10, interactive=False) - @unittest.skip("Disabled because it requires an anthropic API key to test") def test_cli_7(self): + unittest.skipIf( + not os.environ.get("ANTHROPIC_API_KEY"), + "Anthropic API key must be set to run this test.", + ) # Suppress ResourceWarning warnings.filterwarnings( action="ignore", message="unclosed", category=ResourceWarning @@ -42,6 +66,10 @@ def test_cli_7(self): arena.launch_cli(max_steps=6, interactive=False) def test_cli_8(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/interview.json") arena.launch_cli(max_steps=16, interactive=False) @@ -51,6 +79,10 @@ def test_cli_9(self): arena.launch_cli(max_steps=6, interactive=False) def test_cli_10(self): + unittest.skipIf( + not os.getenv("OPENAI_API_KEY"), + "OpenAI API key must be set to run this test.", + ) arena = Arena.from_config("examples/prisoners_dilemma.json") arena.launch_cli(max_steps=3, interactive=False)