Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
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
Hide 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'):
raise
RuntimeError
(
"Can't bind to %s:%s"
%
host_port
)
except
ValueError
:
default_host
=
host_port
[
1
]
for
port
in
xrange
(
55000
,
55500
):
yield
default_host
,
port
raise
RuntimeError
(
"Can't find free port (tried ports 55000 to 55500)"
)
# Try to return predictable ports for someone who has several unit test
# instances on the same machine. This shuffles the whole port range lazily.
m
=
499
# must be a prime number
x
=
instance_random
.
randrange
(
0
,
m
)
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'
):
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