mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
copy
This commit is contained in:
parent
52a9df5b34
commit
f683e76332
1 changed files with 51 additions and 0 deletions
|
@ -8,6 +8,8 @@ GPT figures out which files need to be edited, and asks permission to make chang
|
||||||
It then disables all the color and pretty-printing functions if NO_COLOR is
|
It then disables all the color and pretty-printing functions if NO_COLOR is
|
||||||
set, so the tool conforms to the specification.
|
set, so the tool conforms to the specification.
|
||||||
|
|
||||||
|
The user then asks for a test case, which GPT adds as well.
|
||||||
|
|
||||||
## Chat transcript
|
## Chat transcript
|
||||||
> $ aider
|
> $ aider
|
||||||
> Using git repo: .git
|
> Using git repo: .git
|
||||||
|
@ -103,3 +105,52 @@ These changes will make the software check for the `NO_COLOR` environment variab
|
||||||
> Applied edit to aider/io.py
|
> Applied edit to aider/io.py
|
||||||
> Applied edit to aider/io.py
|
> Applied edit to aider/io.py
|
||||||
> Commit 3218242 aider: Added check for NO_COLOR environment variable to disable ANSI color.
|
> Commit 3218242 aider: Added check for NO_COLOR environment variable to disable ANSI color.
|
||||||
|
|
||||||
|
#### add a test
|
||||||
|
|
||||||
|
To add a test for the `NO_COLOR` environment variable, we will create a new test function in the `tests/test_io.py` file. Since this file does not exist, we will create it first.
|
||||||
|
|
||||||
|
```python
|
||||||
|
tests/test_io.py
|
||||||
|
<<<<<<< ORIGINAL
|
||||||
|
=======
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
from aider.io import InputOutput
|
||||||
|
|
||||||
|
class TestInputOutput(unittest.TestCase):
|
||||||
|
def test_no_color_environment_variable(self):
|
||||||
|
with patch.dict(os.environ, {"NO_COLOR": "1"}):
|
||||||
|
io = InputOutput()
|
||||||
|
self.assertFalse(io.pretty)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
|
>>>>>>> UPDATED
|
||||||
|
```
|
||||||
|
|
||||||
|
This test function checks if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
|
||||||
|
|
||||||
|
> Allow creation of new file tests/test_io.py? y
|
||||||
|
> Add tests/test_io.py to git? y
|
||||||
|
> Applied edit to tests/test_io.py
|
||||||
|
> Commit 52a9df5 aider: Added a test function to check if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
|
||||||
|
|
||||||
|
#### /run pytest
|
||||||
|
|
||||||
|
> ============================= test session starts ==============================
|
||||||
|
> platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
|
||||||
|
> rootdir: /Users/gauthier/Projects/aider
|
||||||
|
> collected 25 items
|
||||||
|
>
|
||||||
|
> tests/test_coder.py ...... [ 24%]
|
||||||
|
> tests/test_commands.py . [ 28%]
|
||||||
|
> tests/test_io.py . [ 32%]
|
||||||
|
> tests/test_main.py .... [ 48%]
|
||||||
|
> tests/test_repomap.py ... [ 60%]
|
||||||
|
> tests/test_utils.py .......... [100%]
|
||||||
|
>
|
||||||
|
> ============================== 25 passed in 1.41s ==============================
|
||||||
|
>
|
||||||
|
> Add the output to the chat? y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue