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.
This commit is contained in:
Paul Gauthier 2023-05-27 13:59:48 -07:00
parent 775f6fc192
commit 0ec5c69fc4

View file

@ -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)