Correct timing in test_pytester.test_testdir_run_with_timeout()

This commit is contained in:
Kyle Altendorf 2018-10-08 15:54:14 -04:00
parent a6fb4c8268
commit 4071c8a4a8
1 changed files with 4 additions and 2 deletions

View File

@ -412,13 +412,15 @@ def test_testdir_run_no_timeout(testdir):
def test_testdir_run_with_timeout(testdir):
testfile = testdir.makepyfile("def test_no_timeout(): pass")
timeout = 120
start = time.time()
result = testdir.runpytest_subprocess(testfile, timeout=120)
result = testdir.runpytest_subprocess(testfile, timeout=timeout)
end = time.time()
duration = end - start
assert result.ret == EXIT_OK
assert duration < 5
assert duration < timeout
def test_testdir_run_timeout_expires(testdir):