Skip to content

Commit

Permalink
Fix a test case for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Nov 25, 2018
1 parent 4d836f1 commit 48f2c1a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/test_subproc_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@


os_type = platform.system()
if os_type in ["Linux", "Darwin"]:
if os_type == "Linux":
list_command = "ls"
list_command_errno = errno.ENOENT
list_command_errno = [errno.ENOENT]
elif os_type == "Darwin":
list_command = "ls"
list_command_errno = [1, errno.ENOENT]
elif os_type == "Windows":
list_command = "dir"
list_command_errno = 1
list_command_errno = [1]
else:
raise NotImplementedError(os_type)

Expand All @@ -35,10 +38,10 @@ class Test_SubprocessRunner_run(object):
@pytest.mark.parametrize(
["command", "dry_run", "expected"],
[
[list_command, False, 0],
[list_command, True, 0],
[list_command, False, [0]],
[list_command, True, [0]],
[list_command + " __not_exist_dir__", False, list_command_errno],
[list_command + " __not_exist_dir__", True, 0],
[list_command + " __not_exist_dir__", True, [0]],
],
)
def test_normal(self, command, dry_run, expected):
Expand All @@ -48,7 +51,7 @@ def test_normal(self, command, dry_run, expected):
if not dry_run:
print(r.stderr, file=sys.stderr)

assert r.returncode == expected
assert r.returncode in expected

@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.parametrize(
Expand Down

0 comments on commit 48f2c1a

Please sign in to comment.