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
nexedi
ZODB
Commits
bee97cf1
Commit
bee97cf1
authored
Jun 05, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an onfail argument to wait_until to provide alternate behavior
for a timeout.
parent
04581d75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/ZEO/tests/forker.py
src/ZEO/tests/forker.py
+9
-8
No files found.
src/ZEO/tests/forker.py
View file @
bee97cf1
...
...
@@ -137,7 +137,7 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
args
.
append
(
"-S"
)
if
protocol
:
args
.
extend
([
"-v"
,
protocol
])
d
=
os
.
environ
.
copy
()
d
[
'PYTHONPATH'
]
=
os
.
pathsep
.
join
(
sys
.
path
)
...
...
@@ -222,7 +222,7 @@ def get_port(test=None):
if
test
is
not
None
:
return
get_port2
(
test
)
for
i
in
range
(
10
):
port
=
random
.
randrange
(
20000
,
30000
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
...
...
@@ -281,7 +281,7 @@ def can_connect(port):
else
:
c
.
close
()
return
True
def
setUp
(
test
):
ZODB
.
tests
.
util
.
setUp
(
test
)
...
...
@@ -330,13 +330,14 @@ def setUp(test):
test
.
globs
[
'wait_disconnected'
]
=
wait_disconnected
def
wait_until
(
label
,
func
,
timeout
=
30
):
now
=
time
.
time
()
giveup
=
now
+
30
def
wait_until
(
label
,
func
,
timeout
=
30
,
onfail
=
None
):
giveup
=
time
.
time
()
+
timeout
while
not
func
():
now
=
time
.
time
()
if
time
.
time
()
>
giveup
:
raise
AssertionError
(
"Timed out waiting for: "
,
label
)
if
onfail
is
None
:
raise
AssertionError
(
"Timed out waiting for: "
,
label
)
else
:
return
onfail
()
time
.
sleep
(
0.01
)
def
wait_connected
(
storage
):
...
...
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