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
a14e8264
Commit
a14e8264
authored
Oct 15, 2018
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Python 2 compat
parent
5dba8d39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
src/greentest/test__greenlet.py
src/greentest/test__greenlet.py
+6
-7
No files found.
src/greentest/test__greenlet.py
View file @
a14e8264
...
@@ -700,11 +700,10 @@ class TestBasic(greentest.TestCase):
...
@@ -700,11 +700,10 @@ class TestBasic(greentest.TestCase):
gevent
.
sleep
(
0.01
)
gevent
.
sleep
(
0.01
)
def
test_add_spawn_callback
(
self
):
def
test_add_spawn_callback
(
self
):
called
=
0
called
=
{
'#'
:
0
}
def
cb
(
gr
):
def
cb
(
gr
):
nonlocal
called
called
[
'#'
]
+=
1
called
+=
1
gr
.
_called_test
=
True
gr
.
_called_test
=
True
gevent
.
Greenlet
.
add_spawn_callback
(
cb
)
gevent
.
Greenlet
.
add_spawn_callback
(
cb
)
...
@@ -712,24 +711,24 @@ class TestBasic(greentest.TestCase):
...
@@ -712,24 +711,24 @@ class TestBasic(greentest.TestCase):
g
=
gevent
.
spawn
(
lambda
:
None
)
g
=
gevent
.
spawn
(
lambda
:
None
)
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
g
.
join
()
g
.
join
()
self
.
assertEqual
(
called
,
1
)
self
.
assertEqual
(
called
[
'#'
]
,
1
)
g
=
gevent
.
spawn_later
(
1e-5
,
lambda
:
None
)
g
=
gevent
.
spawn_later
(
1e-5
,
lambda
:
None
)
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
g
.
join
()
g
.
join
()
self
.
assertEqual
(
called
,
2
)
self
.
assertEqual
(
called
[
'#'
]
,
2
)
g
=
gevent
.
Greenlet
(
lambda
:
None
)
g
=
gevent
.
Greenlet
(
lambda
:
None
)
g
.
start
()
g
.
start
()
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
self
.
assertTrue
(
hasattr
(
g
,
'_called_test'
))
g
.
join
()
g
.
join
()
self
.
assertEqual
(
called
,
3
)
self
.
assertEqual
(
called
[
'#'
]
,
3
)
gevent
.
Greenlet
.
remove_spawn_callback
(
cb
)
gevent
.
Greenlet
.
remove_spawn_callback
(
cb
)
g
=
gevent
.
spawn
(
lambda
:
None
)
g
=
gevent
.
spawn
(
lambda
:
None
)
self
.
assertFalse
(
hasattr
(
g
,
'_called_test'
))
self
.
assertFalse
(
hasattr
(
g
,
'_called_test'
))
g
.
join
()
g
.
join
()
self
.
assertEqual
(
called
,
3
)
self
.
assertEqual
(
called
[
'#'
]
,
3
)
finally
:
finally
:
gevent
.
Greenlet
.
remove_spawn_callback
(
cb
)
gevent
.
Greenlet
.
remove_spawn_callback
(
cb
)
...
...
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