Skip to content

Commit 2cf4d87

Browse files
authored
Merge pull request #806 from python-cmd2/fix_tests
Fixing unit tests that were causing problems on the test servers
2 parents 2e8779f + d33c2dc commit 2cf4d87

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

tests/test_utils.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,24 +227,24 @@ def test_stdsim_line_buffering(base_app):
227227
def pr_none():
228228
import subprocess
229229

230+
# Start a long running process so we have time to run tests on it before it finishes
230231
# Put the new process into a separate group so signals sent to it won't interfere with this process
231232
if sys.platform.startswith('win'):
232-
command = 'dir'
233+
command = 'timeout -t 5 /nobreak'
233234
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP
234235
start_new_session = False
235236
else:
236-
command = 'ls'
237+
command = 'sleep 5'
237238
creationflags = 0
238239
start_new_session = True
239240

240-
proc = subprocess.Popen([command],
241+
proc = subprocess.Popen(command,
241242
creationflags=creationflags,
242243
start_new_session=start_new_session,
243244
shell=True)
244245
pr = cu.ProcReader(proc, None, None)
245246
return pr
246247

247-
@pytest.mark.skipif(sys.platform == 'linux', reason="Test doesn't work correctly on TravisCI")
248248
def test_proc_reader_send_sigint(pr_none):
249249
assert pr_none._proc.poll() is None
250250
pr_none.send_sigint()
@@ -255,8 +255,6 @@ def test_proc_reader_send_sigint(pr_none):
255255
else:
256256
assert ret_code == -signal.SIGINT
257257

258-
@pytest.mark.skipif(not sys.platform.startswith('win'),
259-
reason="Test doesn't work correctly on TravisCI and is unreliable on Azure DevOps macOS")
260258
def test_proc_reader_terminate(pr_none):
261259
assert pr_none._proc.poll() is None
262260
pr_none.terminate()
@@ -267,13 +265,6 @@ def test_proc_reader_terminate(pr_none):
267265
else:
268266
assert ret_code == -signal.SIGTERM
269267

270-
@pytest.mark.skipif(not sys.platform.startswith('win'),
271-
reason="Test doesn't work correctly on TravisCI and is unreliable on Azure DevOps macOS")
272-
def test_proc_reader_wait(pr_none):
273-
assert pr_none._proc.poll() is None
274-
pr_none.wait()
275-
assert pr_none._proc.poll() == 0
276-
277268

278269
@pytest.fixture
279270
def context_flag():

0 commit comments

Comments
 (0)