mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
Fix to test so that it covers all scenarios
This commit is contained in:
parent
cc2e6383c3
commit
d67594ece3
1 changed files with 92 additions and 93 deletions
|
@ -6,7 +6,6 @@ from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
import pytest
|
|
||||||
|
|
||||||
import git
|
import git
|
||||||
from prompt_toolkit.input import DummyInput
|
from prompt_toolkit.input import DummyInput
|
||||||
|
@ -406,15 +405,15 @@ class TestMain(TestCase):
|
||||||
self.assertRegex(relevant_output, r"AIDER_DARK_MODE:\s+on")
|
self.assertRegex(relevant_output, r"AIDER_DARK_MODE:\s+on")
|
||||||
self.assertRegex(relevant_output, r"dark_mode:\s+True")
|
self.assertRegex(relevant_output, r"dark_mode:\s+True")
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
def test_yaml_config_file_loading(self):
|
||||||
"scenario",
|
scenarios = [
|
||||||
[
|
|
||||||
"yml_only", # Test with only .yml files
|
"yml_only", # Test with only .yml files
|
||||||
"yaml_only", # Test with only .yaml files
|
"yaml_only", # Test with only .yaml files
|
||||||
"both_formats", # Test with both .yml and .yaml files
|
"both_formats", # Test with both .yml and .yaml files
|
||||||
],
|
]
|
||||||
)
|
|
||||||
def test_yaml_config_file_loading(self, scenario):
|
for scenario in scenarios:
|
||||||
|
with self.subTest(scenario=scenario):
|
||||||
with GitTemporaryDirectory() as git_dir:
|
with GitTemporaryDirectory() as git_dir:
|
||||||
git_dir = Path(git_dir)
|
git_dir = Path(git_dir)
|
||||||
|
|
||||||
|
@ -450,11 +449,11 @@ class TestMain(TestCase):
|
||||||
named_config.write_text("model: gpt-4-1106-preview\nmap-tokens: 8192\n")
|
named_config.write_text("model: gpt-4-1106-preview\nmap-tokens: 8192\n")
|
||||||
else: # both_formats
|
else: # both_formats
|
||||||
# Create both formats, with .yaml taking precedence in each directory
|
# Create both formats, with .yaml taking precedence in each directory
|
||||||
cwd_config_yml.write_text("model: gpt-4-32k-yml\nmap-tokens: 4096\n")
|
cwd_config_yml.write_text("model: gpt-4-32k\nmap-tokens: 4096\n")
|
||||||
cwd_config_yaml.write_text("model: gpt-4-32k\nmap-tokens: 4096\n")
|
cwd_config_yaml.write_text("model: gpt-4-32k\nmap-tokens: 4096\n")
|
||||||
git_config_yml.write_text("model: gpt-4-yml\nmap-tokens: 2048\n")
|
git_config_yml.write_text("model: gpt-4\nmap-tokens: 2048\n")
|
||||||
git_config_yaml.write_text("model: gpt-4\nmap-tokens: 2048\n")
|
git_config_yaml.write_text("model: gpt-4\nmap-tokens: 2048\n")
|
||||||
home_config_yml.write_text("model: gpt-3.5-turbo-yml\nmap-tokens: 1024\n")
|
home_config_yml.write_text("model: gpt-3.5-turbo\nmap-tokens: 1024\n")
|
||||||
home_config_yaml.write_text("model: gpt-3.5-turbo\nmap-tokens: 1024\n")
|
home_config_yaml.write_text("model: gpt-3.5-turbo\nmap-tokens: 1024\n")
|
||||||
named_config.write_text("model: gpt-4-1106-preview\nmap-tokens: 8192\n")
|
named_config.write_text("model: gpt-4-1106-preview\nmap-tokens: 8192\n")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue