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
53c7cd1c
Commit
53c7cd1c
authored
Oct 19, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow fileno to be a long on py2.
parent
d2a87921
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
greentest/test__makefile_ref.py
greentest/test__makefile_ref.py
+8
-5
No files found.
greentest/test__makefile_ref.py
View file @
53c7cd1c
...
...
@@ -15,6 +15,9 @@ lsof_command = 'lsof -p %s > %s' % (pid, tmpname)
import
sys
PY3
=
sys
.
version_info
[
0
]
>=
3
fd_types
=
int
if
not
PY3
:
fd_types
=
(
int
,
long
)
def
get_open_files
():
...
...
@@ -56,24 +59,24 @@ class Test(unittest.TestCase):
raise AssertionError('
NOT
RAISED
EBADF
:
%
r
()
returned
%
r' % (func, result))
def assert_fd_open(self, fileno):
assert isinstance(fileno,
int
)
assert isinstance(fileno,
fd_types
)
open_files = get_open_files()
if fileno not in open_files:
raise AssertionError('
%
r
is
not
open
:
\
n
%
s
' % (fileno, open_files['
data
']))
def assert_fd_closed(self, fileno):
assert isinstance(fileno,
int
), repr(fileno)
assert isinstance(fileno,
fd_types
), repr(fileno)
assert fileno > 0, fileno
open_files = get_open_files()
if fileno in open_files:
raise AssertionError('
%
r
is
not
closed
:
\
n
%
s
' % (fileno, open_files['
data
']))
def assert_open(self, sock, *rest):
if isinstance(sock,
int
):
if isinstance(sock,
fd_types
):
self.assert_fd_open(sock)
else:
fileno = sock.fileno()
assert isinstance(fileno,
int
), fileno
assert isinstance(fileno,
fd_types
), fileno
sockname = sock.getsockname()
assert isinstance(sockname, tuple), sockname
self.assert_fd_open(fileno)
...
...
@@ -81,7 +84,7 @@ class Test(unittest.TestCase):
self.assert_open(rest[0], *rest[1:])
def assert_closed(self, sock, *rest):
if isinstance(sock,
int
):
if isinstance(sock,
fd_types
):
self.assert_fd_closed(sock)
else:
# Under Python3, the socket module returns -1 for a fileno
...
...
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