Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Kirill Smelkov
gevent
Commits
689d91db
Commit
689d91db
authored
Oct 13, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove special code for python 2.5 since we don't support that anymore.
parent
f7e9f654
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
115 deletions
+109
-115
greentest/test_threading_2.py
greentest/test_threading_2.py
+109
-115
No files found.
greentest/test_threading_2.py
View file @
689d91db
...
...
@@ -12,23 +12,12 @@ threading.Lock = Lock
threading.RLock = RLock
threading.Semaphore = Semaphore
threading.BoundedSemaphore = BoundedSemaphore
if not hasattr(threading, 'current_thread'):
threading.current_thread = threading.currentThread
if not hasattr(threading.Thread, 'name'):
threading.Thread.name = property(lambda self: self.getName())
if not hasattr(threading.Thread, 'is_alive'):
threading.Thread.is_alive = threading.Thread.isAlive
if not hasattr(threading.Thread, 'daemon'):
threading.Thread.daemon = property(threading.Thread.isDaemon, threading.Thread.setDaemon)
if hasattr(threading, '_Condition') and not hasattr(threading._Condition, 'notify_all'):
threading._Condition.notify_all = threading._Condition.notifyAll
'''
exec
(
setup_
)
setup_3
=
'
\
n
'
.
join
(
' %s'
%
line
for
line
in
setup_
.
split
(
'
\
n
'
))
setup_4
=
'
\
n
'
.
join
(
' %s'
%
line
for
line
in
setup_
.
split
(
'
\
n
'
))
setup_5
=
'
\
n
'
.
join
(
' %s'
%
line
for
line
in
setup_
.
split
(
'
\
n
'
))
try
:
...
...
@@ -140,14 +129,22 @@ class ThreadTests(unittest.TestCase):
print('
all
tasks
done
')
self.assertEqual(numrunning.get(), 0)
if sys.version_info[:2] > (2, 5):
def test_ident_of_no_threading_threads(self):
# The ident still must work for the main thread and dummy threads.
self.assertFalse(threading.currentThread().ident is None)
# The ident still must work for the main thread and dummy threads,
# as must the repr and str.
t = threading.currentThread()
self.assertFalse(t.ident is None)
str(t)
repr(t)
def f():
ident.append(threading.currentThread().ident)
t = threading.currentThread()
ident.append(t.ident)
str(t)
repr(t)
done.set()
done = threading.Event()
ident = []
thread.start_new_thread(f, ())
...
...
@@ -271,7 +268,6 @@ class ThreadTests(unittest.TestCase):
t
.
join
()
# else the thread is still running, and we have no way to kill it
if
sys
.
version_info
[:
2
]
>
(
2
,
5
):
def
test_limbo_cleanup
(
self
):
# Issue 7481: Failure to start thread should cleanup the limbo map.
def
fail_new_thread
(
*
args
):
...
...
@@ -287,7 +283,6 @@ class ThreadTests(unittest.TestCase):
finally
:
threading
.
_start_new_thread
=
_start_new_thread
if
sys
.
version_info
[:
2
]
>
(
2
,
5
):
def
test_finalize_runnning_thread
(
self
):
# Issue 1402: the PyGILState_Ensure / _Release functions may be called
# very late on python exit: on deallocation of a running thread for
...
...
@@ -332,10 +327,9 @@ class ThreadTests(unittest.TestCase):
thread.start_new_thread(waitingThread, ())
ready.acquire() # Be sure the other thread is waiting.
sys.exit(42)
"""
%
setup_4
])
"""
%
setup_3
])
self
.
assertEqual
(
rc
,
42
)
if
sys
.
version_info
[:
2
]
>
(
2
,
5
):
def
test_join_nondaemon_on_shutdown
(
self
):
# Issue 1722344
# Raising SystemExit skipped threading._shutdown
...
...
@@ -353,7 +347,7 @@ class ThreadTests(unittest.TestCase):
threading.Thread(target=child).start()
raise SystemExit
"""
%
setup_5
],
"""
%
setup_4
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
...
...
@@ -383,7 +377,7 @@ class ThreadTests(unittest.TestCase):
finally
:
sys
.
setcheckinterval
(
old_interval
)
if
sys
.
version_info
[:
2
]
>
(
2
,
5
)
and
not
hasattr
(
sys
,
'pypy_version_info'
):
if
not
hasattr
(
sys
,
'pypy_version_info'
):
def
test_no_refcycle_through_target
(
self
):
class
RunSelfFunction
(
object
):
def
__init__
(
self
,
should_raise
):
...
...
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