Skip to content
Merged
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
17 changes: 14 additions & 3 deletions tests/test_command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@
return True if platform.python_implementation().lower() == "pypy" else False


def is_macos():
"""
Checks if under Mac OS
"""
return platform.system().lower() == "darwin"


def test_standard_ping_with_encoding():
"""
Test command_runner with a standard ping and encoding parameter
Expand Down Expand Up @@ -243,9 +250,13 @@

# WIP We could improve tests here by capturing logs
"""
valid_exit_codes = [0, 1, 2]
if is_macos():
valid_exit_codes.append(68) # ping non-existent exits with such on Mac
for method in methods:
exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=[0, 1, 2], method=method)
assert exit_code in [0, 1, 2], 'Exit code not in valid list with method {}'.format(method)

exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=valid_exit_codes, method=method)
assert exit_code in valid_exit_codes, 'Exit code not in valid list with method {}'.format(method)

exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=True, method=method)
assert exit_code != 0, 'Exit code should not be equal to 0'
Expand Down Expand Up @@ -768,4 +779,4 @@
test_split_streams()
test_on_exit()
test_priority()
test_no_close_queues()
test_no_close_queues()

Check warning on line 782 in tests/test_command_runner.py

View check run for this annotation

Codecov / codecov/patch

tests/test_command_runner.py#L782

Added line #L782 was not covered by tests
Loading