Skip to content

Commit

Permalink
Modify pytest.mark.skipif conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Feb 12, 2020
1 parent 0160b84 commit b3e4987
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/test_subproc_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_normal(self, command, dry_run, expected):

assert r.returncode in expected

@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(
["command", "expected"], [[list_command + " -l", 0], [[list_command, "-l"], 0]]
)
Expand All @@ -70,7 +70,7 @@ def test_stdout(self, command, expected):
assert runner.stdout.strip() == expected
assert is_null_string(runner.stderr)

@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(
["command", "ignore_stderr_regexp", "out_regexp", "expected"],
[
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_stderr(self, capsys, command, ignore_stderr_regexp, out_regexp, expecte
actual = out_regexp.search(err) is not None
assert actual == expected

@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(
["command", "ignore_stderr_regexp", "expected"],
[
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_normal(self, command, environ, expected):
assert is_null_string(ret_stderr)
assert proc.returncode == expected

@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(["command", "pipe_input", "expected"], [["grep a", b"aaa", 0]])
def test_normal_stdin(self, command, pipe_input, expected):
proc = SubprocessRunner(command).popen(PIPE)
Expand Down
10 changes: 5 additions & 5 deletions test/test_which.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""


import platform # noqa: W0611
import platform
import re

import pytest
Expand All @@ -28,7 +28,7 @@ def test_exception(self, value, expected):


class Test_Which_repr:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(
["value", "expected_regexp"],
[
Expand All @@ -44,7 +44,7 @@ def test_normal(self, value, expected_regexp):


class Test_Which_is_exist:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(
["value", "expected"], [["ls", True], ["/bin/ls", True], ["__not_exist_command__", False]]
)
Expand All @@ -61,7 +61,7 @@ def test_normal_windows(self, value, expected):


class Test_Which_verify:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(["value"], [["ls"]])
def test_normal_linux(self, value):
Which(value).verify()
Expand All @@ -80,7 +80,7 @@ def test_exception(self, value, expected):


class Test_Which_abspath:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.skipif(platform.system() == "Windows", reason="platform dependent tests")
@pytest.mark.parametrize(["value"], [["ls"]])
def test_normal_linux(self, value):
assert is_not_null_string(Which(value).abspath())
Expand Down

0 comments on commit b3e4987

Please sign in to comment.