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
Kirill Smelkov
ZODB
Commits
cfa60a7a
Commit
cfa60a7a
authored
Sep 07, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge in zeo-1_0-branch
parent
4dfb633e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
src/ZEO/tests/forker.py
src/ZEO/tests/forker.py
+21
-4
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+4
-4
No files found.
src/ZEO/tests/forker.py
View file @
cfa60a7a
...
...
@@ -4,12 +4,31 @@ import asyncore
import
os
import
profile
import
random
import
socket
import
sys
import
types
import
ZEO.ClientStorage
,
ZEO
.
StorageServer
PROFILE
=
0
def
get_port
():
"""Return a port that is not in use.
Checks if a port is in use by trying to connect to it. Assumes it
is not in use if connect raises an exception.
Raises RuntimeError after 10 tries.
"""
for
i
in
range
(
10
):
port
=
random
.
randrange
(
20000
,
30000
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
try
:
s
.
connect
((
'localhost'
,
port
))
except
socket
.
error
:
# XXX check value of error?
return
port
raise
RuntimeError
,
"Can't find port"
if
os
.
name
==
"nt"
:
def
start_zeo_server
(
storage_name
,
args
,
port
=
None
):
...
...
@@ -18,8 +37,7 @@ if os.name == "nt":
Returns the ZEO port, the test server port, and the pid.
"""
import
ZEO.tests.winserver
if
port
is
None
:
port
=
random
.
randrange
(
20000
,
30000
)
port
=
get_port
()
script
=
ZEO
.
tests
.
winserver
.
__file__
if
script
.
endswith
(
'.pyc'
):
script
=
script
[:
-
1
]
...
...
@@ -93,8 +111,7 @@ else:
"""
if
domain
==
"AF_INET"
:
import
random
addr
=
''
,
random
.
randrange
(
2000
,
3000
)
addr
=
''
,
get_port
()
elif
domain
==
"AF_UNIX"
:
import
tempfile
addr
=
tempfile
.
mktemp
()
...
...
src/ZEO/tests/testZEO.py
View file @
cfa60a7a
...
...
@@ -222,7 +222,7 @@ class ConnectionTests(ZEOTestBase):
start and stop a ZEO storage server.
"""
__super_
setUp
=
StorageTestBase
.
StorageTestBase
.
setUp
__super_
tearDown
=
StorageTestBase
.
StorageTestBase
.
tearDown
ports
=
[]
for
i
in
range
(
200
):
...
...
@@ -242,7 +242,7 @@ class ConnectionTests(ZEOTestBase):
self
.
shutdownServer
()
# file storage appears to create four files
for
ext
in
''
,
'.index'
,
'.lock'
,
'.tmp'
:
path
=
self
.
__fs_bas
e
+
ext
path
=
self
.
fil
e
+
ext
if
os
.
path
.
exists
(
path
):
os
.
unlink
(
path
)
for
i
in
0
,
1
:
...
...
@@ -325,13 +325,13 @@ class UnixConnectionTests(ConnectionTests):
getStorage() method.
"""
self
.
running
=
1
self
.
__fs_bas
e
=
tempfile
.
mktemp
()
self
.
fil
e
=
tempfile
.
mktemp
()
self
.
addr
=
''
,
self
.
ports
.
pop
()
self
.
_startServer
()
self
.
__super_setUp
()
def
_startServer
(
self
,
create
=
1
):
fs
=
FileStorage
(
self
.
__fs_bas
e
,
create
=
create
)
fs
=
FileStorage
(
self
.
fil
e
,
create
=
create
)
self
.
_pid
,
self
.
_server
=
forker
.
start_zeo_server
(
fs
,
self
.
addr
)
def
openClientStorage
(
self
,
cache
=
''
,
cache_size
=
200000
,
wait
=
1
):
...
...
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