test: update invalid edit format test to check return code instead of SystemExit

This commit is contained in:
Paul Gauthier (aider) 2024-11-26 07:07:11 -08:00
parent 743f0f5540
commit b70e0bd1f6

View file

@ -670,12 +670,12 @@ class TestMain(TestCase):
def test_invalid_edit_format(self):
with GitTemporaryDirectory():
with patch("aider.io.InputOutput.offer_url") as mock_offer_url:
with self.assertRaises(SystemExit):
main(
result = main(
["--edit-format", "not-a-real-format", "--exit", "--yes"],
input=DummyInput(),
output=DummyOutput(),
)
self.assertEqual(result, 1) # main() should return 1 on error
mock_offer_url.assert_called_once()
args, _ = mock_offer_url.call_args
self.assertEqual(args[0], "https://aider.chat/docs/edit-formats.html")