Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
ac8d8472
Commit
ac8d8472
authored
Dec 09, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runUnitTest: scan port range in random order to find free ports for ZServers
parent
40fe8fda
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+10
-5
No files found.
product/ERP5Type/tests/utils.py
View file @
ac8d8472
...
@@ -306,11 +306,16 @@ def parseListeningAddress(host_port=None, default_host='127.0.0.1'):
...
@@ -306,11 +306,16 @@ def parseListeningAddress(host_port=None, default_host='127.0.0.1'):
raise
RuntimeError
(
"Can't bind to %s:%s"
%
host_port
)
raise
RuntimeError
(
"Can't bind to %s:%s"
%
host_port
)
except
ValueError
:
except
ValueError
:
default_host
=
host_port
[
1
]
default_host
=
host_port
[
1
]
# Try to return predictable ports for someone who has several unit test
for
port
in
xrange
(
55000
,
55500
):
# instances on the same machine. This shuffles the whole port range lazily.
yield
default_host
,
port
m
=
499
# must be a prime number
x
=
instance_random
.
randrange
(
0
,
m
)
raise
RuntimeError
(
"Can't find free port (tried ports 55000 to 55500)"
)
c
=
instance_random
.
randrange
(
1
,
m
)
for
i
in
xrange
(
m
):
yield
default_host
,
55000
+
x
x
=
(
x
+
c
)
%
m
raise
RuntimeError
(
"Can't find free port (tried ports %u to %u)
\
n
"
%
(
55000
,
54999
+
m
))
def
createZServer
(
log
=
os
.
devnull
,
zserver_type
=
'http'
):
def
createZServer
(
log
=
os
.
devnull
,
zserver_type
=
'http'
):
import
ZServer
import
ZServer
...
...
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