Skip to content

Commit

Permalink
test/xfreerdp: skip --help failure cases
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jul 25, 2020
1 parent 53f624f commit b41b97c
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions test/t/test_xfreerdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@

class TestXfreerdp:
def _help(self, bash):
return assert_bash_exec(bash, "xfreerdp --help || :", want_output=True)
return assert_bash_exec(
bash, "xfreerdp --help 2>&1 || :", want_output=True
)

@pytest.fixture(scope="class")
def slash_syntax(self, bash):
def help_success(self, bash):
output = self._help(bash)
# Example from our CentOS 7 container
# [04:51:31:663] [238:238] [ERROR][com.freerdp.client.x11] - Failed to get pixmap info
if not output or "ERROR" in output.strip().splitlines()[0]:
pytest.skip("--help errored")

@pytest.fixture(scope="class")
def slash_syntax(self, bash, help_success):
if "/help" not in self._help(bash):
pytest.skip("Not slash syntax")

Expand All @@ -18,31 +28,31 @@ def dash_syntax(self, bash):
pytest.skip("Not dash syntax")

@pytest.mark.complete("xfreerdp /", require_cmd=True)
def test_1(self, bash, completion, slash_syntax):
def test_1(self, bash, completion, help_success, slash_syntax):
assert completion

@pytest.mark.complete("xfreerdp -", require_cmd=True)
def test_2(self, completion):
def test_2(self, completion, help_success):
assert completion

@pytest.mark.complete("xfreerdp +", require_cmd=True)
def test_3(self, bash, completion, slash_syntax):
def test_3(self, bash, completion, help_success, slash_syntax):
assert completion

@pytest.mark.complete(
"xfreerdp /kbd:",
require_cmd=True,
skipif='test -z "$(xfreerdp /kbd-list 2>/dev/null)"',
)
def test_4(self, bash, completion, slash_syntax):
def test_4(self, bash, completion, help_success, slash_syntax):
assert completion

@pytest.mark.complete("xfreerdp /help ", require_cmd=True)
def test_5(self, completion):
def test_5(self, completion, help_success):
assert not completion

@pytest.mark.complete("xfreerdp -k ", require_cmd=True)
def test_6(self, bash, completion, dash_syntax):
def test_6(self, bash, completion, help_success, dash_syntax):
assert completion

@pytest.mark.complete("xfreerdp --help ", require_cmd=True)
Expand Down

0 comments on commit b41b97c

Please sign in to comment.