diff --git a/squape/squishserver.py b/squape/squishserver.py index 538f138..f1ca2b5 100644 --- a/squape/squishserver.py +++ b/squape/squishserver.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os from pathlib import Path +from pathlib import PureWindowsPath try: import squish @@ -76,7 +77,7 @@ def _config_squishserver(self, config_option: str, params=None, cwd=None): config_option (str): the config option to be used during configuration. params (list, optional): the configuration parameters. Defaults to []. cwd (str): the path to the current working directory. - Defaults to the "SQUISH_PREFIX" environment vairable. + Defaults to the squishserver location. """ if params is None: params = [] @@ -89,7 +90,15 @@ def _config_squishserver(self, config_option: str, params=None, cwd=None): f"Executing command: {' '.join(cmd)}", f"cwd: {cwd}", ) - (exitcode, stdout, stderr) = self.remotesys.execute(cmd, cwd) + + if self.remotesys.getOSName() == "Windows": + (exitcode, stdout, stderr) = self.remotesys.execute(cmd, cwd) + else: + cmd_str = self.location + "/bin/" + " ".join(cmd) + (exitcode, stdout, stderr) = self.remotesys.execute( + ["sh", "-c", cmd_str], cwd + ) + if exitcode != "0": raise SquishserverError( f"[Squishserver {self.host}:{self.port}] " @@ -108,11 +117,12 @@ def addAUT(self, aut: str, path: str) -> None: aut (str): the name of the executable path (str): path to the executable folder """ + path_resolved = PureWindowsPath(path).as_posix().strip() log( f"[Squishserver {self.host}:{self.port}] " - f"Registering {Path(path)/aut} AUT" + f"Registering {path_resolved}/{aut} AUT" ) - self._config_squishserver("addAUT", [aut, path]) + self._config_squishserver("addAUT", [aut, path_resolved]) def removeAUT(self, aut: str, path: str) -> None: """Remove registered AUT @@ -133,8 +143,12 @@ def addAppPath(self, path: str) -> None: Args: path (str): the AUT path to register """ - log(f"[Squishserver {self.host}:{self.port}] " f"Registering AUT path: {path}") - self._config_squishserver("addAppPath", [path]) + path_resolved = PureWindowsPath(path).as_posix().strip() + log( + f"[Squishserver {self.host}:{self.port}] " + f"Registering AUT path: {path_resolved}" + ) + self._config_squishserver("addAppPath", [path_resolved]) def removeAppPath(self, path: str) -> None: """Remove a registered AUT path @@ -142,11 +156,12 @@ def removeAppPath(self, path: str) -> None: Args: path (str): the path to the AUT """ + path_resolved = PureWindowsPath(path).as_posix().strip() log( f"[Squishserver {self.host}:{self.port}] " - f"Removing registered AUT path: {path}" + f"Removing registered AUT path: {path_resolved}" ) - self._config_squishserver("removeAppPath", [path]) + self._config_squishserver("removeAppPath", [path_resolved]) def addAttachableAut(self, aut: str, port: int, host: str = "127.0.0.1") -> None: """Register an attachable AUT