Skip to content

Commit

Permalink
tests: Fix tests on py34
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed Mar 20, 2015
1 parent 8807f38 commit 22e8b77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions testinfra/modules/test/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def test_run(mock_subprocess):
mock_subprocess().configure_mock(**{
"communicate.return_value": ("out", "err"),
"communicate.return_value": (b"out", b"err"),
"returncode": 42,
})
cmd = Command("ls %s", "; rm -rf /foo")
Expand All @@ -34,15 +34,15 @@ def test_run(mock_subprocess):

def test_check_output(mock_subprocess):
mock_subprocess().configure_mock(**{
"communicate.return_value": ("out", ""),
"communicate.return_value": (b"out", b""),
"returncode": 0,
})
assert Command.check_output("zzzzzzz") == "out"


def test_check_output_error(mock_subprocess):
mock_subprocess().configure_mock(**{
"communicate.return_value": ("", ""),
"communicate.return_value": (b"", b""),
"returncode": 127,
})
with pytest.raises(AssertionError):
Expand Down
12 changes: 6 additions & 6 deletions testinfra/modules/test/test_sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
def test_osinfo(mock_subprocess):
values = [
# uname -s
("Linux\n", ""),
(b"Linux\n", b""),
# lsb_release -a
((
"Distributor ID: Debian\n"
"Description: Debian GNU/Linux 7.8 (wheezy)\n"
"Release: 7.8\n"
"Codename: wheezy\n"
), "No LSB modules are available.\n"),
b"Distributor ID: Debian\n"
b"Description: Debian GNU/Linux 7.8 (wheezy)\n"
b"Release: 7.8\n"
b"Codename: wheezy\n"
), b"No LSB modules are available.\n"),
]
mock_subprocess().configure_mock(**{
"communicate.side_effect": values,
Expand Down

0 comments on commit 22e8b77

Please sign in to comment.