@@ -111,6 +111,13 @@ def is_pypy():
111111 return True if platform .python_implementation ().lower () == "pypy" else False
112112
113113
114+ def is_macos ():
115+ """
116+ Checks if under Mac OS
117+ """
118+ return platform .system ().lower () == "darwin"
119+
120+
114121def test_standard_ping_with_encoding ():
115122 """
116123 Test command_runner with a standard ping and encoding parameter
@@ -243,9 +250,13 @@ def test_valid_exit_codes():
243250
244251 # WIP We could improve tests here by capturing logs
245252 """
253+ valid_exit_codes = [0 , 1 , 2 ]
254+ if is_macos ():
255+ valid_exit_codes .append (68 ) # ping non-existent exits with such on Mac
246256 for method in methods :
247- exit_code , _ = command_runner ('ping nonexistent_host' , shell = True , valid_exit_codes = [0 , 1 , 2 ], method = method )
248- assert exit_code in [0 , 1 , 2 ], 'Exit code not in valid list with method {}' .format (method )
257+
258+ exit_code , _ = command_runner ('ping nonexistent_host' , shell = True , valid_exit_codes = valid_exit_codes , method = method )
259+ assert exit_code in valid_exit_codes , 'Exit code not in valid list with method {}' .format (method )
249260
250261 exit_code , _ = command_runner ('ping nonexistent_host' , shell = True , valid_exit_codes = True , method = method )
251262 assert exit_code != 0 , 'Exit code should not be equal to 0'
@@ -768,4 +779,4 @@ def test_no_close_queues():
768779 test_split_streams ()
769780 test_on_exit ()
770781 test_priority ()
771- test_no_close_queues ()
782+ test_no_close_queues ()
0 commit comments