diff --git a/tests/fixtures/test_fixture.py b/tests/fixtures/test_fixture.py index 3e785ee..7ccc35f 100644 --- a/tests/fixtures/test_fixture.py +++ b/tests/fixtures/test_fixture.py @@ -5,7 +5,7 @@ class MyTestCase(TestCase): def test_long_running_task(self): # Simulate a long-running task - time.sleep(5) + time.sleep(1) # Add your actual test assertions here (if any) self.assertEqual(1 + 1, 2) diff --git a/tests/src/commands/test_annotate_and_test_runner.py b/tests/src/commands/test_annotate_and_test_runner.py index 622799f..be4dfdf 100644 --- a/tests/src/commands/test_annotate_and_test_runner.py +++ b/tests/src/commands/test_annotate_and_test_runner.py @@ -24,8 +24,8 @@ def _open_test_fixture_file(self): ) # wait for view to open - while test_file_view.is_loading(): - pass + # while test_file_view.is_loading(): + # pass return test_file_view @@ -46,43 +46,43 @@ def test_run(self, mocked_get_test_config): self.assertEqual(len(annotated_regions), 3) - # @patch("os.path.exists") - # @patch("PyRock.src.commands.annotate_and_test_runner.AnnotateAndTestRunnerCommand._run_test_command") - # @patch("sublime.load_settings") - # def test_click_on_annotated_html( - # self, - # mocked_load_settings, - # mocked_run_test_command, - # mocked_os_path_exists, - # ): - # mocked_load_settings.return_value = { - # "python_venv_path": "/Users/abhishek/venv/bin/activate", - # "log_level": "debug", - # "test_config": { - # "enabled": True, - # "test_framework": "pytest", - # "working_directory": "/Users/abhishek/", - # "test_runner_command": ["pytest"], - # } - # } - # mocked_os_path_exists.return_value = True - - # test_file_view = self._open_test_fixture_file() - - # self.test_runner_cmd.run(test_file_view) - # self.test_runner_cmd._execute_test("0") - - # test_command = """ - # set -e - # . "/Users/abhishek/venv/bin/activate" - # cd "/Users/abhishek/" - # pytest tests/fixtures/test_fixture.py::MyTestCase - # deactivate - # """ - - # mocked_run_test_command.assert_called_once_with( - # test_command - # ) + @patch("os.path.exists") + @patch("PyRock.src.commands.annotate_and_test_runner.AnnotateAndTestRunnerCommand._run_test_command") + @patch("sublime.load_settings") + def test_click_on_annotated_html( + self, + mocked_load_settings, + mocked_run_test_command, + mocked_os_path_exists, + ): + mocked_load_settings.return_value = { + "python_venv_path": "/Users/abhishek/venv/bin/activate", + "log_level": "debug", + "test_config": { + "enabled": True, + "test_framework": "pytest", + "working_directory": "/Users/abhishek/", + "test_runner_command": ["pytest"], + } + } + mocked_os_path_exists.return_value = True + + test_file_view = self._open_test_fixture_file() + + self.test_runner_cmd.run(test_file_view) + self.test_runner_cmd._execute_test("0") + + test_command = """ + set -e + . "/Users/abhishek/venv/bin/activate" + cd "/Users/abhishek/" + pytest tests/fixtures/test_fixture.py::MyTestCase + deactivate + """ + + mocked_run_test_command.assert_called_once_with( + test_command + ) @patch("PyRock.src.commands.output_panel.OutputPanel.show") @patch("PyRock.src.settings.SettingsTestConfigField._get_value")