mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Tests: Configurable check for taskd readyness
* Also increase the frequency from 1/s to 2/s
This commit is contained in:
parent
834b4ddab6
commit
526665d4ec
2 changed files with 5 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import division
|
||||
import os
|
||||
import tempfile
|
||||
import shutil
|
||||
|
@ -188,7 +189,7 @@ class Taskd(object):
|
|||
|
||||
return True
|
||||
|
||||
def start(self, minutes=5):
|
||||
def start(self, minutes=5, tries_per_minute=2):
|
||||
"""Start the taskd server if it's not running.
|
||||
If it's already running OSError will be raised
|
||||
"""
|
||||
|
@ -199,10 +200,10 @@ class Taskd(object):
|
|||
raise OSError("Taskd server is still running or crashed")
|
||||
|
||||
# Wait for server to listen by checking connectivity in the port
|
||||
# Default is to wait up to 5 minutes checking once each second
|
||||
for i in range(minutes * 60):
|
||||
# Default is to wait up to 5 minutes checking once every 500ms
|
||||
for i in range(minutes * 60 * tries_per_minute):
|
||||
if not self.status():
|
||||
sleep(1)
|
||||
sleep(1 / tries_per_minute)
|
||||
else:
|
||||
return
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ def wait_condition(cond, timeout=1):
|
|||
# Max number of attempts until giving up
|
||||
tries = int(timeout / sleeptime)
|
||||
|
||||
# Wait for up to a second for the process to finish and avoid zombies
|
||||
for i in range(tries):
|
||||
val = cond()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue