Commit 0c1d7fcd authored by Jason Madden's avatar Jason Madden

Tweaks for PyPy3 on Linux.

parent d5782662
...@@ -54,11 +54,19 @@ class Test(greentest.TestCase): ...@@ -54,11 +54,19 @@ class Test(greentest.TestCase):
raise raise
raise AssertionError('NOT RAISED EBADF: %r() returned %r' % (func, result)) raise AssertionError('NOT RAISED EBADF: %r() returned %r' % (func, result))
def assert_fd_open(self, fileno): if WIN or (PYPY and PY3 and greentest.LINUX):
assert isinstance(fileno, fd_types) def __assert_fd_open(self, fileno):
open_files = get_open_files() # We can't detect open file descriptors on Windows.
if fileno not in open_files: # On PyPy 3.6-7.3 on Travis CI (linux), for some reason the
raise AssertionError('%r is not open:\n%s' % (fileno, open_files['data'])) # client file descriptors don't always show as open. Don't know why,
# was fine in 7.2.
pass
else:
def __assert_fd_open(self, fileno):
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): def assert_fd_closed(self, fileno):
assert isinstance(fileno, fd_types), repr(fileno) assert isinstance(fileno, fd_types), repr(fileno)
...@@ -79,21 +87,14 @@ class Test(greentest.TestCase): ...@@ -79,21 +87,14 @@ class Test(greentest.TestCase):
def assert_open(self, sock, *rest): def assert_open(self, sock, *rest):
if isinstance(sock, fd_types): if isinstance(sock, fd_types):
if WIN or (PYPY and PY3 and greentest.LINUX): self.__assert_fd_open(sock)
# We can't detect open file descriptors on Windows.
# On PyPy 3.6-7.3 on Travis CI (linux), for some reason the
# client file descriptors don't always show as open. Don't know why,
# was fine in 7.2.
pass
else:
self.assert_fd_open(sock)
else: else:
fileno = sock.fileno() fileno = sock.fileno()
assert isinstance(fileno, fd_types), fileno assert isinstance(fileno, fd_types), fileno
sockname = sock.getsockname() sockname = sock.getsockname()
assert isinstance(sockname, tuple), sockname assert isinstance(sockname, tuple), sockname
if not WIN: if not WIN:
self.assert_fd_open(fileno) self.__assert_fd_open(fileno)
else: else:
self._assert_sock_open(sock) self._assert_sock_open(sock)
if rest: if rest:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment