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
c082ee69
Commit
c082ee69
authored
Jun 23, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asyncio: Add an unit test to check that setting the PYTHONASYNCIODEBUG env var
enables debug mode of the event loop.
parent
7b7120e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+24
-0
Lib/test/test_asyncio/test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+0
-4
No files found.
Lib/test/test_asyncio/test_base_events.py
View file @
c082ee69
...
@@ -7,6 +7,7 @@ import sys
...
@@ -7,6 +7,7 @@ import sys
import
time
import
time
import
unittest
import
unittest
from
unittest
import
mock
from
unittest
import
mock
from
test.script_helper
import
assert_python_ok
from
test.support
import
IPV6_ENABLED
from
test.support
import
IPV6_ENABLED
import
asyncio
import
asyncio
...
@@ -489,6 +490,29 @@ class BaseEventLoopTests(test_utils.TestCase):
...
@@ -489,6 +490,29 @@ class BaseEventLoopTests(test_utils.TestCase):
self
.
assertIs
(
type
(
_context
[
'context'
][
'exception'
]),
self
.
assertIs
(
type
(
_context
[
'context'
][
'exception'
]),
ZeroDivisionError
)
ZeroDivisionError
)
def
test_env_var_debug
(
self
):
code
=
'
\
n
'
.
join
((
'import asyncio'
,
'loop = asyncio.get_event_loop()'
,
'print(loop.get_debug())'
))
# Test with -E to not fail if the unit test was run with
# PYTHONASYNCIODEBUG set to a non-empty string
sts
,
stdout
,
stderr
=
assert_python_ok
(
'-E'
,
'-c'
,
code
)
self
.
assertEqual
(
stdout
.
rstrip
(),
b'False'
)
sts
,
stdout
,
stderr
=
assert_python_ok
(
'-c'
,
code
,
PYTHONASYNCIODEBUG
=
''
)
self
.
assertEqual
(
stdout
.
rstrip
(),
b'False'
)
sts
,
stdout
,
stderr
=
assert_python_ok
(
'-c'
,
code
,
PYTHONASYNCIODEBUG
=
'1'
)
self
.
assertEqual
(
stdout
.
rstrip
(),
b'True'
)
sts
,
stdout
,
stderr
=
assert_python_ok
(
'-E'
,
'-c'
,
code
,
PYTHONASYNCIODEBUG
=
'1'
)
self
.
assertEqual
(
stdout
.
rstrip
(),
b'False'
)
class
MyProto
(
asyncio
.
Protocol
):
class
MyProto
(
asyncio
.
Protocol
):
done
=
None
done
=
None
...
...
Lib/test/test_asyncio/test_tasks.py
View file @
c082ee69
...
@@ -1577,11 +1577,7 @@ class GatherTestsBase:
...
@@ -1577,11 +1577,7 @@ class GatherTestsBase:
self
.
assertEqual
(
fut
.
result
(),
[
3
,
1
,
exc
,
exc2
])
self
.
assertEqual
(
fut
.
result
(),
[
3
,
1
,
exc
,
exc2
])
def
test_env_var_debug
(
self
):
def
test_env_var_debug
(
self
):
path
=
os
.
path
.
dirname
(
asyncio
.
__file__
)
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
path
,
'..'
))
code
=
'
\
n
'
.
join
((
code
=
'
\
n
'
.
join
((
'import sys'
,
'sys.path.insert(0, %r)'
%
path
,
'import asyncio.tasks'
,
'import asyncio.tasks'
,
'print(asyncio.tasks._DEBUG)'
))
'print(asyncio.tasks._DEBUG)'
))
...
...
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