def test_hang(testdir):
p = py.path.local(__file__).dirpath('conftest.py')
p.copy(testdir.tmpdir.join(p.basename))
t = testdir.makepyfile("""
import pytest
from eventlet.green import time
@pytest.mark.timeout(0.01)
def test_hang():
time.sleep(3.0)
""")
result = testdir.runpytest()
assert "failed to timeout" not in result.stdout.str()
result.stdout.fnmatch_lines(["*Timeout: 0.01*"])
评论列表
文章目录