Skip to content

Commit

Permalink
windows test and asset path fix
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 09c31da commit e8fb1da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions src/commands/annotate_and_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,21 @@ def _get_test_command(self, test_path: str) -> str:
test_path=test_path,
)
else:
working_directory = PyRockSettings().TEST_CONFIG.WORKING_DIR.replace(
'\\', '\\\\'
)
run_test_command = " ".join(
PyRockSettings().TEST_CONFIG.TEST_RUNNER_COMMAND
).replace('\\', '\\\\')

if PyRockSettings().PYTHON_VIRTUAL_ENV_PATH.value:
venv_path = PyRockSettings().PYTHON_VIRTUAL_ENV_PATH.value.replace(
'\\', '\\\\'
)
working_directory = PyRockSettings().TEST_CONFIG.WORKING_DIR.replace(
'\\', '\\\\'
)
run_test_command = " ".join(
PyRockSettings().TEST_CONFIG.TEST_RUNNER_COMMAND
).replace('\\', '\\\\')

test_command = [
venv_path, '&&', 'cd', working_directory, '&&', run_test_command, test_path, 'deactivate'
]
else:
run_test_command = " ".join(
PyRockSettings().TEST_CONFIG.TEST_RUNNER_COMMAND
).replace('\\', '\\\\')

test_command = ['cd', working_directory, '&&', run_test_command, test_path]

return test_command
Expand Down Expand Up @@ -351,6 +347,8 @@ def run(self, view: View):
PyRockConstants.RELATIVE_PACKAGE_ASSETS_DIR,
"beaker.png"
)
if sublime.platform() == PyRockConstants.PLATFORM_WINDOWS:
test_gutter_icon_path = test_gutter_icon_path.replace('\\', '/')

self.region_key = f"pyrock-gutter-icon-{self.view.id()}"

Expand Down
2 changes: 1 addition & 1 deletion src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _validate(self):
self.WORKING_DIR = self._field_value.get("working_directory")
if self.WORKING_DIR is None or (self.WORKING_DIR and not os.path.exists(self.WORKING_DIR)):
raise InvalidTestConfig(
f"Invalid or not existing working directory {self.TEST_FRAMEWORK}"
f"Invalid or not existing working directory {self.WORKING_DIR}"
)

self.TEST_RUNNER_COMMAND = self._field_value.get("test_runner_command")
Expand Down

0 comments on commit e8fb1da

Please sign in to comment.