fix test for windows

This commit is contained in:
Paul Gauthier 2024-06-29 09:22:05 -07:00
parent a888f0dcf2
commit fd62a29b1a
3 changed files with 10 additions and 8 deletions

View file

@ -219,7 +219,7 @@ class TestCoder(unittest.TestCase):
files = [file1, file2] files = [file1, file2]
# Initialize the Coder object with the mocked IO and mocked repo # Initialize the Coder object with the mocked IO and mocked repo
coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files) coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files, pretty=False)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = "ok" coder.partial_response_content = "ok"
@ -246,7 +246,7 @@ class TestCoder(unittest.TestCase):
files = [file1, file2] files = [file1, file2]
# Initialize the Coder object with the mocked IO and mocked repo # Initialize the Coder object with the mocked IO and mocked repo
coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files) coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files, pretty=False)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = "ok" coder.partial_response_content = "ok"
@ -337,7 +337,7 @@ class TestCoder(unittest.TestCase):
fname = Path("file.txt") fname = Path("file.txt")
io = InputOutput(yes=True) io = InputOutput(yes=True)
coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)]) coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)], pretty=False)
self.assertTrue(fname.exists()) self.assertTrue(fname.exists())
@ -394,7 +394,9 @@ new
fname1.write_text("ONE\n") fname1.write_text("ONE\n")
io = InputOutput(yes=True) io = InputOutput(yes=True)
coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname1), str(fname2)]) coder = Coder.create(
self.GPT35, "diff", io=io, fnames=[str(fname1), str(fname2)], pretty=False
)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = f""" coder.partial_response_content = f"""
@ -447,7 +449,7 @@ TWO
fname2.write_text("OTHER\n") fname2.write_text("OTHER\n")
io = InputOutput(yes=True) io = InputOutput(yes=True)
coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)]) coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)], pretty=False)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = f""" coder.partial_response_content = f"""
@ -525,7 +527,7 @@ three
repo.git.commit("-m", "initial") repo.git.commit("-m", "initial")
io = InputOutput(yes=True) io = InputOutput(yes=True)
coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)]) coder = Coder.create(self.GPT35, "diff", io=io, fnames=[str(fname)], pretty=False)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = f""" coder.partial_response_content = f"""

View file

@ -297,7 +297,7 @@ These changes replace the `subprocess.run` patches with `subprocess.check_output
files = [file1] files = [file1]
# Initialize the Coder object with the mocked IO and mocked repo # Initialize the Coder object with the mocked IO and mocked repo
coder = Coder.create(self.GPT35, "diff", io=InputOutput(), fnames=files) coder = Coder.create(self.GPT35, "diff", io=InputOutput(), fnames=files, pretty=False)
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):
coder.partial_response_content = f""" coder.partial_response_content = f"""
@ -340,6 +340,7 @@ new
io=InputOutput(dry_run=True), io=InputOutput(dry_run=True),
fnames=files, fnames=files,
dry_run=True, dry_run=True,
pretty=False,
) )
def mock_send(*args, **kwargs): def mock_send(*args, **kwargs):

View file

@ -309,7 +309,6 @@ Do this:
return [] return []
coder.send = MagicMock(side_effect=mock_send) coder.send = MagicMock(side_effect=mock_send)
coder.live_incremental_response = lambda x: x
# Call the run method with a message # Call the run method with a message
coder.run(with_message="hi") coder.run(with_message="hi")