Skip to content

Commit e397570

Browse files
committed
Added tmux as a run method
1 parent 295cdd7 commit e397570

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

tests/installer/install_methods.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def help_message(self) -> str:
185185

186186
class Screen(InstallMethod):
187187
def __init__(self) -> None:
188-
self.cmd = 'screen -d -m bash -c "./psij-ci-run --repeat --log"'
188+
self.cmd = 'screen -d -m bash -c "./psij-ci-run --repeat --tee"'
189189

190190
def is_available(self) -> Tuple[bool, Optional[str]]:
191191
if _succeeds('which screen'):
@@ -218,6 +218,41 @@ def help_message(self) -> str:
218218
'reboots.')
219219

220220

221+
class Tmux(InstallMethod):
222+
def __init__(self) -> None:
223+
self.cmd = 'tmux new -d bash -c "./psij-ci-run --repeat --tee"'
224+
225+
def is_available(self) -> Tuple[bool, Optional[str]]:
226+
if _succeeds('which tmux'):
227+
return True, None
228+
else:
229+
return False, 'not found'
230+
231+
def already_installed(self) -> bool:
232+
ec, out = _run('tmux list-sessions -F "#{pane_start_command}" | grep psij-ci-run')
233+
return ec == 0
234+
235+
def install(self) -> None:
236+
_must_succeed(self.cmd)
237+
238+
@property
239+
def preview(self) -> str:
240+
return self.cmd
241+
242+
@property
243+
def name(self) -> str:
244+
return 'tmux'
245+
246+
@property
247+
def label(self) -> str:
248+
return 'tmux - another terminal multiplexer'
249+
250+
@property
251+
def help_message(self) -> str:
252+
return ('Uses tmux to run tests in a tmux pane. Does not persist across '
253+
'reboots.')
254+
255+
221256
class Custom(InstallMethod):
222257
def is_available(self) -> Tuple[bool, Optional[str]]:
223258
return True, None
@@ -231,7 +266,7 @@ def install(self) -> None:
231266
@property
232267
def preview(self) -> str:
233268
cwd = os.getcwd()
234-
return f'"{cwd}/psij-ci-run" --log'
269+
return f'"{cwd}/psij-ci-run" --log --repeat'
235270

236271
@property
237272
def name(self) -> str:
@@ -251,6 +286,7 @@ def help_message(self) -> str:
251286
Crontab(),
252287
At(),
253288
Screen(),
289+
Tmux(),
254290
Custom()
255291
]
256292

0 commit comments

Comments
 (0)