Use os.devnull + do not check if system exists for os module

This commit is contained in:
Tymoteusz Jankowski
2019-12-02 20:27:20 +01:00
parent f79711d155
commit ab3ccf0243
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -423,5 +423,5 @@ def resolve_output(inp, out):
def is_exec_found(exec_name):
cmd = "({}) 2>/dev/null".format(exec_name)
return hasattr(os, "system") and os.system(cmd) == 0
cmd = "({}) 2>{}".format(exec_name, os.devnull)
return os.system(cmd) == 0
+1 -1
View File
@@ -91,7 +91,7 @@ def test_makedirs_permissions(tmpdir):
def test_is_exec_found_returns_true_when_program_exists():
result = utils.is_exec_found("python")
result = utils.is_exec_found("echo")
assert result is True