Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for tmux-2.6 #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hecate/tmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def execute_command(self, *command):
return subprocess.check_output(
cmd,
stderr=subprocess.STDOUT
).decode('ascii')
).decode()
except subprocess.CalledProcessError as e:
if b"failed to connect to server: Connection refused" in e.output:
raise DeadServer(e.output)
if b"failed to connect to server: Connection refused" in e.output\
or b"no server running" in e.output:
raise DeadServer(e.output) from e

raise CommandFailed(e.output)

def new_session(
Expand Down
5 changes: 3 additions & 2 deletions tests/test_mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def test_creates_sessions_of_desired_name():
def test_can_capture_a_pane():
name = "testcapturing"
mux = newmux()
height = 50
mux.new_session(
width=50, height=50, command="echo hello world; bash", name=name
width=50, height=height, command="echo hello world; bash", name=name
)
sessions = mux.sessions()
assert name in sessions
Expand All @@ -74,7 +75,7 @@ def test_can_capture_a_pane():
assert len(panes) == 1
pane_contents = mux.capture_pane(panes[0])
assert "hello world" in pane_contents
assert len(pane_contents.split("\n")) == 50
assert len(pane_contents.split("\n")) == height + 1


def test_can_send_content_to_the_screen():
Expand Down