Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
957868c5
Commit
957868c5
authored
Dec 19, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a helper function to wait until something is true.
parent
dce9dc1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
src/ZEO/tests/forker.py
src/ZEO/tests/forker.py
+12
-11
No files found.
src/ZEO/tests/forker.py
View file @
957868c5
...
...
@@ -326,20 +326,21 @@ def setUp(test):
test
.
globs
[
'wait_connected'
]
=
wait_connected
test
.
globs
[
'wait_disconnected'
]
=
wait_disconnected
def
wait_connected
(
storage
):
def
wait_until
(
func
,
timeout
=
30
,
label
=
None
):
if
not
label
:
label
=
func
.
__name__
now
=
time
.
time
()
giveup
=
now
+
30
while
not
storage
.
is_connected
():
while
not
func
():
now
=
time
.
time
()
if
time
.
time
()
>
giveup
:
raise
AssertionError
(
"timed out waiting for storage to connect"
)
time
.
sleep
(
0.1
)
raise
AssertionError
(
"Timed out waiting for"
,
label
)
time
.
sleep
(
0.01
)
def
wait_connected
(
storage
):
wait_until
(
storage
.
is_connected
)
def
wait_disconnected
(
storage
):
now
=
time
.
time
()
giveup
=
now
+
30
while
storage
.
is_connected
():
now
=
time
.
time
()
if
time
.
time
()
>
giveup
:
raise
AssertionError
(
"timed out waiting for storage to connect"
)
time
.
sleep
(
0.1
)
def
not_connected
():
return
not
storage
.
is_connected
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment