Skip to content
Merged
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
9 changes: 2 additions & 7 deletions exec_helpers/exec_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,7 @@ def __str__(self): # type: () -> str

def __eq__(self, other): # type: (typing.Any) -> bool
"""Comparision."""
return all(
(
getattr(self, val) == getattr(other, val)
for val in ['cmd', 'stdout', 'stderr', 'exit_code']
)
)
return hash(self) == hash(other)

def __ne__(self, other): # type: (typing.Any) -> bool
"""Comparision."""
Expand All @@ -440,6 +435,6 @@ def __hash__(self):
"""Hash for usage as dict key and in sets."""
return hash(
(
self.__class__, self.cmd, self.stdout, self.stderr,
self.__class__, self.cmd, self.stdin, self.stdout, self.stderr,
self.exit_code
))
1 change: 1 addition & 0 deletions test/test_exec_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def test_create_minimal(self, logger):
(
exec_helpers.ExecResult,
cmd,
None,
(),
(),
exec_helpers.ExitCodes.EX_INVALID
Expand Down
2 changes: 1 addition & 1 deletion test/test_subprocess_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def test_006_check_stdin_bytearray(
): # type: (...) -> None
stdin = bytearray(b'this is a line')

popen_obj, exp_result = self.prepare_close(popen, cmd=print_stdin, stdout_override=[stdin])
popen_obj, exp_result = self.prepare_close(popen, cmd=print_stdin, stdout_override=[bytes(l) for l in stdin])

stdin_mock = mock.Mock()
popen_obj.attach_mock(stdin_mock, 'stdin')
Expand Down