From 0ec5c69fc403bbc5ec191d96c400062b8fe8ad87 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 27 May 2023 13:59:48 -0700 Subject: [PATCH] aider: Set OPENAI_API_KEY environment variable to "deadbeef" for all tests. # Context: USER: set env OPENAI_API_KEY=deadbeef for all tests ASSISTANT: To set the environment variable `OPENAI_API_KEY` for all tests, you can modify the `setUp` method in the `TestMain` class in the `tests/test_main.py` file. Here's the change: ```python tests/test_main.py <<<<<<< ORIGINAL class TestMain(TestCase): def test_main_with_empty_dir_no_files_on_command(self): ======= class TestMain(TestCase): def setUp(self): os.environ["OPENAI_API_KEY"] = "deadbeef" def test_main_with_empty_dir_no_files_on_command(self): >>>>>>> UPDATED ``` This will set the `OPENAI_API_KEY` environment variable to "deadbeef" before running each test. --- tests/test_main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index 9cd6fd8d7..f2ee9eaf1 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -10,6 +10,9 @@ from prompt_toolkit.output import DummyOutput class TestMain(TestCase): + def setUp(self): + os.environ["OPENAI_API_KEY"] = "deadbeef" + def test_main_with_empty_dir_no_files_on_command(self): with tempfile.TemporaryDirectory() as temp_dir: os.chdir(temp_dir)