From d6320581afd8ba49a183d50403e7c7ef305dee39 Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:55:02 +0200 Subject: [PATCH] fix: fixes cli test starts UI bug in CI/CD (#1404) ## Description The PR fixes issue with CLI unit tests, where some of the tests were starting UI because of unexpected MagicMock behavior causing infinite test runs. ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Changes Made - The PR fixes issue with CLI unit tests, where some of the tests were starting UI because of unexpected MagicMock behavior causing infinite test runs. ## Testing Tested it via CI/CD + manually ## Screenshots/Videos (if applicable) None ## Pre-submission Checklist - [x] **I have tested my changes thoroughly before submitting this PR** - [x] **This PR contains minimal changes necessary to address the issue/feature** - [x] My code follows the project's coding standards and style guidelines - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added necessary documentation (if applicable) - [x] All new and existing tests pass - [x] I have searched existing PRs to ensure this change hasn't been submitted already - [x] I have linked any relevant issues in the description - [x] My commits have clear and descriptive messages ## Related Issues None ## Additional Notes None ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin. --- cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py b/cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py index 44f23ea5c..1ad8eb09e 100644 --- a/cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py +++ b/cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py @@ -49,7 +49,7 @@ class TestCliMain: def test_main_no_command(self, mock_create_parser): """Test main function when no command is provided""" mock_parser = MagicMock() - mock_parser.parse_args.return_value = MagicMock(command=None) + mock_parser.parse_args.return_value = MagicMock(command=None, spec={}) mock_create_parser.return_value = (mock_parser, {}) result = main() @@ -64,7 +64,7 @@ class TestCliMain: mock_command.execute.return_value = None mock_parser = MagicMock() - mock_args = MagicMock(command="test") + mock_args = MagicMock(command="test", spec={}) mock_parser.parse_args.return_value = mock_args mock_create_parser.return_value = (mock_parser, {"test": mock_command}) @@ -84,7 +84,7 @@ class TestCliMain: mock_command.execute.side_effect = CliCommandException("Test error", error_code=2) mock_parser = MagicMock() - mock_args = MagicMock(command="test") + mock_args = MagicMock(command="test", spec={}) mock_parser.parse_args.return_value = mock_args mock_create_parser.return_value = (mock_parser, {"test": mock_command}) @@ -103,7 +103,7 @@ class TestCliMain: mock_command.execute.side_effect = Exception("Generic error") mock_parser = MagicMock() - mock_args = MagicMock(command="test") + mock_args = MagicMock(command="test", spec={}) mock_parser.parse_args.return_value = mock_args mock_create_parser.return_value = (mock_parser, {"test": mock_command}) @@ -126,7 +126,7 @@ class TestCliMain: mock_command.execute.side_effect = test_exception mock_parser = MagicMock() - mock_args = MagicMock(command="test") + mock_args = MagicMock(command="test", spec={}) mock_parser.parse_args.return_value = mock_args mock_create_parser.return_value = (mock_parser, {"test": mock_command})