Add unit tests for the cmd_lint command

This commit is contained in:
Paul Gauthier 2024-07-29 16:45:57 -03:00 committed by Paul Gauthier (aider)
parent cf35c2db4e
commit f90cd6b69b

View file

@ -6,7 +6,7 @@ import tempfile
import unittest import unittest
from io import StringIO from io import StringIO
from pathlib import Path from pathlib import Path
from unittest import TestCase from unittest import TestCase, mock
import git import git
@ -721,7 +721,7 @@ class TestCommands(TestCase):
file_path.write_text("def hello():\n print('Hello, World!')\n\n# Dirty line\n") file_path.write_text("def hello():\n print('Hello, World!')\n\n# Dirty line\n")
# Mock the linter.lint method # Mock the linter.lint method
with unittest.mock.patch.object(coder.linter, "lint") as mock_lint: with mock.patch.object(coder.linter, "lint") as mock_lint:
# Run cmd_lint # Run cmd_lint
commands.cmd_lint() commands.cmd_lint()