Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodb
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
b43c3f1a
Commit
b43c3f1a
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
bb047cfc
Changes
1
Show 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 @
b43c3f1a
...
...
@@ -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