mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
refac
This commit is contained in:
parent
9785ede960
commit
cdf35cd122
2 changed files with 16 additions and 14 deletions
|
@ -1,24 +1,11 @@
|
||||||
import os
|
import os
|
||||||
import tempfile
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
from aider.repomap import RepoMap
|
from aider.repomap import RepoMap
|
||||||
|
|
||||||
|
from .utils import IgnorantTemporaryDirectory
|
||||||
class IgnorantTemporaryDirectory:
|
|
||||||
def __init__(self):
|
|
||||||
self.temp_dir = tempfile.TemporaryDirectory()
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
return self.temp_dir.__enter__()
|
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
||||||
try:
|
|
||||||
self.temp_dir.__exit__(exc_type, exc_val, exc_tb)
|
|
||||||
except OSError:
|
|
||||||
pass # Ignore errors (Windows)
|
|
||||||
|
|
||||||
|
|
||||||
class TestRepoMap(unittest.TestCase):
|
class TestRepoMap(unittest.TestCase):
|
||||||
|
|
15
tests/utils.py
Normal file
15
tests/utils.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
|
class IgnorantTemporaryDirectory:
|
||||||
|
def __init__(self):
|
||||||
|
self.temp_dir = tempfile.TemporaryDirectory()
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self.temp_dir.__enter__()
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
try:
|
||||||
|
self.temp_dir.__exit__(exc_type, exc_val, exc_tb)
|
||||||
|
except OSError:
|
||||||
|
pass # Ignore errors (Windows)
|
Loading…
Add table
Add a link
Reference in a new issue