mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
[16.01] More robust test_lazy_process.
Hopefully this will fix a transiently failing test (I've only seen in fail on OS X).
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
"""Unit module for LazyProcess object in galaxy.util.lazy_process."""
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
@@ -6,6 +7,7 @@ from galaxy.util.lazy_process import LazyProcess
|
||||
|
||||
|
||||
def test_lazy_process():
|
||||
"""Create process, ensure start_process starts it and shutdown kills it."""
|
||||
t = tempfile.NamedTemporaryFile()
|
||||
os.remove(t.name)
|
||||
lazy_process = LazyProcess(["bash", "-c", "touch %s; sleep 100" % t.name])
|
||||
@@ -15,4 +17,10 @@ def test_lazy_process():
|
||||
time.sleep(.01)
|
||||
assert lazy_process.process.poll() is None
|
||||
lazy_process.shutdown()
|
||||
assert lazy_process.process.poll()
|
||||
ret_val = None
|
||||
for i in range(10):
|
||||
ret_val = lazy_process.process.poll()
|
||||
if ret_val is not None:
|
||||
break
|
||||
time.sleep(.01)
|
||||
assert ret_val is not None
|
||||
|
||||
Reference in New Issue
Block a user