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
83ef2549
Commit
83ef2549
authored
Dec 14, 2011
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #13453: Fix a race condition in test_poplib.
parent
10db4dec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
Lib/test/test_poplib.py
Lib/test/test_poplib.py
+12
-10
No files found.
Lib/test/test_poplib.py
View file @
83ef2549
...
...
@@ -309,32 +309,34 @@ class TestTimeouts(TestCase):
def
setUp
(
self
):
self
.
evt
=
threading
.
Event
()
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
3
)
self
.
sock
.
settimeout
(
60
)
# Safety net. Look issue 11812
self
.
port
=
test_support
.
bind_port
(
self
.
sock
)
threading
.
Thread
(
target
=
self
.
server
,
args
=
(
self
.
evt
,
self
.
sock
)).
start
()
time
.
sleep
(.
1
)
self
.
thread
=
threading
.
Thread
(
target
=
self
.
server
,
args
=
(
self
.
evt
,
self
.
sock
))
self
.
thread
.
setDaemon
(
True
)
self
.
thread
.
start
()
self
.
evt
.
wait
()
def
tearDown
(
self
):
self
.
evt
.
wait
()
self
.
thread
.
join
()
del
self
.
thread
# Clear out any dangling Thread objects.
def
server
(
self
,
evt
,
serv
):
serv
.
listen
(
5
)
evt
.
set
()
try
:
conn
,
addr
=
serv
.
accept
()
except
socket
.
timeout
:
pass
else
:
conn
.
send
(
b"+ Hola mundo
\
n
"
)
conn
.
close
()
except
socket
.
timeout
:
pass
finally
:
serv
.
close
()
evt
.
set
()
def
testTimeoutDefault
(
self
):
self
.
assertTrue
(
socket
.
getdefaulttimeout
()
is
None
)
socket
.
setdefaulttimeout
(
30
)
try
:
pop
=
poplib
.
POP3
(
"localhost"
,
self
.
port
)
pop
=
poplib
.
POP3
(
HOST
,
self
.
port
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertEqual
(
pop
.
sock
.
gettimeout
(),
30
)
...
...
@@ -351,7 +353,7 @@ class TestTimeouts(TestCase):
pop
.
sock
.
close
()
def
testTimeoutValue
(
self
):
pop
=
poplib
.
POP3
(
"localhost"
,
self
.
port
,
timeout
=
30
)
pop
=
poplib
.
POP3
(
HOST
,
self
.
port
,
timeout
=
30
)
self
.
assertEqual
(
pop
.
sock
.
gettimeout
(),
30
)
pop
.
sock
.
close
()
...
...
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