Skip to content

Commit

Permalink
updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek's Macbook Pro authored and Abhishek's Macbook Pro committed May 11, 2024
1 parent 4077ad3 commit 28f3cad
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/test_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
78 changes: 39 additions & 39 deletions tests/src/commands/test_annotate_and_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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")
Expand Down

0 comments on commit 28f3cad

Please sign in to comment.