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
240b5846
Commit
240b5846
authored
Mar 04, 2014
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test__os.py: buffer/memoryview fix on PY3
thanks to @fantix for original patch.
parent
d3a3de6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
greentest/test__os.py
greentest/test__os.py
+14
-2
No files found.
greentest/test__os.py
View file @
240b5846
import
sys
import
six
from
os
import
pipe
from
gevent
import
os
from
greentest
import
TestCase
,
main
...
...
@@ -26,12 +28,12 @@ class TestOS_tp(TestCase):
def
write
(
self
,
*
args
):
return
os
.
tp_write
(
*
args
)
def
test_if_pipe_blocks
(
self
):
def
_test_if_pipe_blocks
(
self
,
buffer_class
):
r
,
w
=
self
.
pipe
()
# set nbytes such that for sure it is > maximum pipe buffer
nbytes
=
1000000
block
=
'x'
*
4096
buf
=
buffer
(
block
)
buf
=
buffer
_class
(
block
)
# Lack of "nonlocal" keyword in Python 2.x:
bytesread
=
[
0
]
byteswritten
=
[
0
]
...
...
@@ -57,6 +59,16 @@ class TestOS_tp(TestCase):
assert
bytesread
[
0
]
==
nbytes
assert
bytesread
[
0
]
==
byteswritten
[
0
]
if
sys
.
version_info
[
0
]
<
3
:
def
test_if_pipe_blocks_buffer
(
self
):
self
.
_test_if_pipe_blocks
(
six
.
builtins
.
buffer
)
if
sys
.
version_info
[:
2
]
>=
(
2
,
7
):
def
test_if_pipe_blocks_memoryview
(
self
):
self
.
_test_if_pipe_blocks
(
six
.
builtins
.
memoryview
)
if
hasattr
(
os
,
'make_nonblocking'
):
...
...
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