| 5 | |
| 6 | |
| 7 | class Application: |
| 8 | class App(Enum): |
| 9 | APPIUM = "appium" |
| 10 | DEVICE = "device" |
| 11 | DISPLAY_SCREEN = "display_screen" |
| 12 | DISPLAY_WM = "display_wm" |
| 13 | PORT_FORWARDER = "port_forwarder" |
| 14 | VNC_SERVER = "vnc_server" |
| 15 | VNC_WEB = "vnc_web" |
| 16 | |
| 17 | def __init__(self, name: str, command: str, additional_args: str = "", ui: bool = False) -> None: |
| 18 | self.logger = logging.getLogger(self.__class__.__name__) |
| 19 | self.name = name |
| 20 | self.command = command |
| 21 | self.additional_args = additional_args |
| 22 | self.ui = ui |
| 23 | |
| 24 | def start(self) -> None: |
| 25 | if self.ui: |
| 26 | self.logger.info(f"{self.name} will be started with ui!") |
| 27 | subprocess.check_call(f"/usr/bin/xterm -T {self.name} -n {self.name} " |
| 28 | f"-e '{self.command} {self.additional_args}'", shell=True) |
| 29 | else: |
| 30 | self.logger.info(f"{self.name} will be started without ui!") |
| 31 | subprocess.check_call(f"{self.command} {self.additional_args}", shell=True) |
| 32 | |
| 33 | def __repr__(self) -> str: |
| 34 | return "Application(name={n}, command={c}, args={args}, ui={ui})".format( |
| 35 | n=self.name, c=self.command, args=self.additional_args, ui=self.ui) |
no outgoing calls
no test coverage detected