Skip to content

Commit

Permalink
updated tests
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 bffaf2b commit f12789a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion tests/src/commands/test_annotate_and_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_run_test_command(self):

with patch("PyRock.src.commands.output_panel.OutputPanel.show") as mocked_panel_show, \
patch("PyRock.src.settings.SettingsTestConfigField._get_value") as mocked_get_test_config, \
patch("sublime.Window.symbol_locations") as mocked_symbol_locations, \
patch("subprocess.Popen") as mocked_process:
mocked_get_test_config.return_value = {
"enabled": True,
Expand All @@ -109,9 +110,13 @@ class TestProcess:

def wait(self):
pass

mocked_process.return_value = TestProcess()

class TestSymbol:
path = test_file_view.file_name()
display_name = "tests/fixtures/test_fixture.py"
mocked_symbol_locations.return_value = [TestSymbol()]

self.test_runner_cmd.run(test_file_view)
self.test_runner_cmd._execute_test("0")

Expand Down
14 changes: 12 additions & 2 deletions tests/src/commands/test_copy_test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ def test_copy_django_individual_method_test_path(self):
}

test_file_view.sel().clear()
test_file_view.sel().add(sublime.Region(272, 286))
test_file_view.sel().add(
sublime.Region(
272 if sublime.platform() == PyRockConstants.PLATFORM_OSX else 271,
286 if sublime.platform() == PyRockConstants.PLATFORM_OSX else 285
)
)

selected_text = test_file_view.substr(test_file_view.sel()[0])
self.assertEqual(selected_text, "test_iam_alone")
Expand Down Expand Up @@ -222,7 +227,12 @@ def test_copy_pytest_individual_method_test_path(self):
}

test_file_view.sel().clear()
test_file_view.sel().add(sublime.Region(272, 286))
test_file_view.sel().add(
sublime.Region(
272 if sublime.platform() == PyRockConstants.PLATFORM_OSX else 271,
286 if sublime.platform() == PyRockConstants.PLATFORM_OSX else 285
)
)

selected_text = test_file_view.substr(test_file_view.sel()[0])
self.assertEqual(selected_text, "test_iam_alone")
Expand Down

0 comments on commit f12789a

Please sign in to comment.