mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-14 13:28:11 +00:00
test fixups
This commit is contained in:
@ -199,10 +199,24 @@ def _create_node(reactor, request, temp_dir, introducer_furl, flog_gatherer, nam
|
||||
return d
|
||||
|
||||
|
||||
def await_file_contents(path, contents, timeout=15):
|
||||
def await_file_contents(path, contents, timeout=15, error_if=None):
|
||||
"""
|
||||
wait up to `timeout` seconds for the file at `path` to have the
|
||||
exact content `contents.
|
||||
|
||||
:param error_if: if specified, a list of additional paths; if any
|
||||
of these paths appear an Exception is raised.
|
||||
"""
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < timeout:
|
||||
print(" waiting for '{}'".format(path))
|
||||
if error_if and any([exists(p) for p in error_if]):
|
||||
raise Exception(
|
||||
"While waiting for '{}', unwanted files appeared: {}".format(
|
||||
path,
|
||||
', '.join([p for p in error_if if exists(p)]),
|
||||
)
|
||||
)
|
||||
if exists(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
|
Reference in New Issue
Block a user