Skip to content

Commit 8f3a5b1

Browse files
tulinkryVladimir Kotal
authored andcommitted
using the predefined markers
1 parent ced24af commit 8f3a5b1

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

opengrok-tools/src/test/python/test_command.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ def test_work_dir():
9393
assert os.getcwd() == orig_cwd
9494

9595

96-
@pytest.mark.skipif(not os.path.exists('/usr/bin/env'),
97-
reason="requires posix")
98-
def test_env():
99-
cmd = Command(['/usr/bin/env'],
100-
env_vars={'FOO': 'BAR', 'A': 'B'})
96+
@system_binary('env')
97+
def test_env(env_binary):
98+
cmd = Command([env_binary], env_vars={'FOO': 'BAR', 'A': 'B'})
10199
cmd.execute()
102100
assert "FOO=BAR\n" in cmd.getoutput()
103101

@@ -121,11 +119,10 @@ def test_command_to_str():
121119
assert str(cmd) == "foo bar"
122120

123121

124-
@pytest.mark.skipif(not os.path.exists('/bin/sleep'),
125-
reason="requires /bin/sleep")
126-
def test_command_timeout():
122+
@system_binary('sleep')
123+
def test_command_timeout(sleep_binary):
127124
timeout = 30
128-
cmd = Command(["/bin/sleep", str(timeout)], timeout=3)
125+
cmd = Command([sleep_binary, str(timeout)], timeout=3)
129126
start_time = time.time()
130127
cmd.execute()
131128
# Check the process is no longer around.
@@ -138,11 +135,10 @@ def test_command_timeout():
138135
assert cmd.getretcode() is None
139136

140137

141-
@pytest.mark.skipif(not os.path.exists('/bin/sleep'),
142-
reason="requires /bin/sleep")
143-
def test_command_notimeout():
138+
@system_binary('sleep')
139+
def test_command_notimeout(sleep_binary):
144140
cmd_timeout = 30
145-
cmd = Command(["/bin/sleep", "3"], timeout=cmd_timeout)
141+
cmd = Command([sleep_binary, "3"], timeout=cmd_timeout)
146142
cmd.execute()
147143
assert cmd.getstate() == Command.FINISHED
148144
assert cmd.getretcode() == 0

0 commit comments

Comments
 (0)