Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
54f9f83e
Commit
54f9f83e
authored
Apr 30, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8576: Remove use of find_unused_port() in test_smtplib and
test_multiprocessing. Patch by Paul Moore.
parent
6d5e579c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
Lib/test/test_multiprocessing.py
Lib/test/test_multiprocessing.py
+3
-3
Lib/test/test_smtplib.py
Lib/test/test_smtplib.py
+8
-4
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_multiprocessing.py
View file @
54f9f83e
...
@@ -1262,9 +1262,9 @@ class _TestManagerRestart(BaseTestCase):
...
@@ -1262,9 +1262,9 @@ class _TestManagerRestart(BaseTestCase):
def
test_rapid_restart
(
self
):
def
test_rapid_restart
(
self
):
authkey
=
os
.
urandom
(
32
)
authkey
=
os
.
urandom
(
32
)
port
=
test_support
.
find_unused_port
()
manager
=
QueueManager
(
manager
=
QueueManager
(
address
=
(
'localhost'
,
port
),
authkey
=
authkey
,
serializer
=
SERIALIZER
)
address
=
(
'localhost'
,
0
),
authkey
=
authkey
,
serializer
=
SERIALIZER
)
addr
=
manager
.
get_server
().
address
manager
.
start
()
manager
.
start
()
p
=
self
.
Process
(
target
=
self
.
_putter
,
args
=
(
manager
.
address
,
authkey
))
p
=
self
.
Process
(
target
=
self
.
_putter
,
args
=
(
manager
.
address
,
authkey
))
...
@@ -1274,7 +1274,7 @@ class _TestManagerRestart(BaseTestCase):
...
@@ -1274,7 +1274,7 @@ class _TestManagerRestart(BaseTestCase):
del
queue
del
queue
manager
.
shutdown
()
manager
.
shutdown
()
manager
=
QueueManager
(
manager
=
QueueManager
(
address
=
(
'localhost'
,
port
)
,
authkey
=
authkey
,
serializer
=
SERIALIZER
)
address
=
addr
,
authkey
=
authkey
,
serializer
=
SERIALIZER
)
manager
.
start
()
manager
.
start
()
manager
.
shutdown
()
manager
.
shutdown
()
...
...
Lib/test/test_smtplib.py
View file @
54f9f83e
...
@@ -155,8 +155,10 @@ class DebuggingServerTests(unittest.TestCase):
...
@@ -155,8 +155,10 @@ class DebuggingServerTests(unittest.TestCase):
self
.
_threads
=
test_support
.
threading_setup
()
self
.
_threads
=
test_support
.
threading_setup
()
self
.
serv_evt
=
threading
.
Event
()
self
.
serv_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
port
=
test_support
.
find_unused_port
()
# Pick a random unused port by passing 0 for the port number
self
.
serv
=
smtpd
.
DebuggingServer
((
HOST
,
self
.
port
),
(
'nowhere'
,
-
1
))
self
.
serv
=
smtpd
.
DebuggingServer
((
HOST
,
0
),
(
'nowhere'
,
-
1
))
# Keep a note of what port was assigned
self
.
port
=
self
.
serv
.
socket
.
getsockname
()[
1
]
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
.
start
()
self
.
thread
.
start
()
...
@@ -392,8 +394,10 @@ class SMTPSimTests(unittest.TestCase):
...
@@ -392,8 +394,10 @@ class SMTPSimTests(unittest.TestCase):
self
.
_threads
=
test_support
.
threading_setup
()
self
.
_threads
=
test_support
.
threading_setup
()
self
.
serv_evt
=
threading
.
Event
()
self
.
serv_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
port
=
test_support
.
find_unused_port
()
# Pick a random unused port by passing 0 for the port number
self
.
serv
=
SimSMTPServer
((
HOST
,
self
.
port
),
(
'nowhere'
,
-
1
))
self
.
serv
=
SimSMTPServer
((
HOST
,
0
),
(
'nowhere'
,
-
1
))
# Keep a note of what port was assigned
self
.
port
=
self
.
serv
.
socket
.
getsockname
()[
1
]
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
.
start
()
self
.
thread
.
start
()
...
...
Misc/NEWS
View file @
54f9f83e
...
@@ -134,6 +134,9 @@ Extension Modules
...
@@ -134,6 +134,9 @@ Extension Modules
Tests
Tests
-----
-----
- Issue #8576: Remove use of find_unused_port() in test_smtplib and
test_multiprocessing. Patch by Paul Moore.
- Issue #7449: Fix many tests to support Python compiled without thread
- Issue #7449: Fix many tests to support Python compiled without thread
support. Patches written by Jerry Seutter.
support. Patches written by Jerry Seutter.
...
...
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