From ac98bfff85275835e0334d53d211cbbc6efdb258 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 03:56:35 +0000 Subject: [PATCH] Initial upload: ErrorFix CLI with rule engine and pattern matching --- tests/test_cli.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/test_cli.py diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..01f29fb --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,46 @@ +import pytest +from click.testing import CliRunner +from errorfix.cli import cli + + +class TestCLI: + def setup_method(self): + self.runner = CliRunner() + + def test_cli_help(self): + result = self.runner.invoke(cli, ['--help']) + assert result.exit_code == 0 + assert 'cli' in result.output.lower() + + def test_fix_command_help(self): + result = self.runner.invoke(cli, ['fix', '--help']) + assert result.exit_code == 0 + assert 'input' in result.output.lower() + + def test_fix_with_stdin_input(self): + result = self.runner.invoke(cli, ['fix', '-i', '-'], input='Unknown error') + assert result.exit_code == 0 + + def test_fix_with_rule_path(self): + result = self.runner.invoke( + cli, + ['fix', '-r', 'rules/python', '-i', '-'], + input="NameError: name 'foo' is not defined" + ) + assert result.exit_code == 0 + + def test_fix_with_json_output(self): + result = self.runner.invoke( + cli, + ['fix', '-f', 'json', '-i', '-'], + input='Unknown error' + ) + assert result.exit_code == 0 + + def test_plugins_command(self): + result = self.runner.invoke(cli, ['plugins']) + assert result.exit_code == 0 + + def test_check_command(self): + result = self.runner.invoke(cli, ['check', '-r', 'rules/python']) + assert result.exit_code == 0