From d65564415bef39346d388ff9a96318a33922e338 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Wed, 4 Oct 2023 14:10:00 +1100 Subject: [PATCH] uncommented `test_code_changes_manual_test_no()` --- pilot/helpers/agents/test_Developer.py | 56 +++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/pilot/helpers/agents/test_Developer.py b/pilot/helpers/agents/test_Developer.py index 2648242..966750a 100644 --- a/pilot/helpers/agents/test_Developer.py +++ b/pilot/helpers/agents/test_Developer.py @@ -98,34 +98,34 @@ class TestDeveloper: # Then assert result == {'success': True, 'user_input': 'continue'} - # @patch('helpers.AgentConvo.get_saved_development_step') - # @patch('helpers.AgentConvo.save_development_step') - # @patch('helpers.AgentConvo.create_gpt_chat_completion') - # @patch('utils.questionary.get_saved_user_input') - # # https://github.com/Pythagora-io/gpt-pilot/issues/35 - # def test_code_changes_manual_test_no(self, mock_get_saved_user_input, mock_chat_completion, mock_save, mock_get_saved_step): - # # Given - # monkey = None - # convo = AgentConvo(self.developer) - # convo.save_branch = lambda branch_name=None: branch_name - # convo.load_branch = lambda function_uuid=None: function_uuid - # self.project.developer = self.developer - # - # mock_chat_completion.side_effect = [ - # {'text': '{"type": "manual_test", "manual_test_description": "Does it look good?"}'}, - # {'text': '{"steps": [{"type": "command", "command": {"command": "something scary", "timeout": 3000}, "check_if_fixed": true}]}'}, - # {'text': 'do something else scary'}, - # ] - # - # mock_questionary = MockQuestionary(['no', 'no']) - # - # with patch('utils.questionary.questionary', mock_questionary): - # # When - # result = self.developer.test_code_changes(monkey, convo) - # - # # Then - # assert result == {'success': True, 'user_input': 'no'} - # + @patch('helpers.AgentConvo.get_saved_development_step') + @patch('helpers.AgentConvo.save_development_step') + @patch('helpers.AgentConvo.create_gpt_chat_completion') + @patch('utils.questionary.get_saved_user_input') + # https://github.com/Pythagora-io/gpt-pilot/issues/35 + def test_code_changes_manual_test_no(self, mock_get_saved_user_input, mock_chat_completion, mock_save, mock_get_saved_step): + # Given + monkey = None + convo = AgentConvo(self.developer) + convo.save_branch = lambda branch_name=None: branch_name + convo.load_branch = lambda function_uuid=None: function_uuid + self.project.developer = self.developer + + mock_chat_completion.side_effect = [ + {'text': '{"type": "manual_test", "manual_test_description": "Does it look good?"}'}, + {'text': '{"steps": [{"type": "command", "command": {"command": "something scary", "timeout": 3000}, "check_if_fixed": true}]}'}, + {'text': 'do something else scary'}, + ] + + mock_questionary = MockQuestionary(['no', 'no']) + + with patch('utils.questionary.questionary', mock_questionary): + # When + result = self.developer.test_code_changes(monkey, convo) + + # Then + assert result == {'success': True, 'user_input': 'no'} + # @patch('helpers.cli.execute_command', return_value=('stdout:\n```\n\n```', 'DONE')) # @patch('helpers.AgentConvo.get_saved_development_step') # @patch('helpers.AgentConvo.save_development_step')