Example #1
0
 def assert_fd_closed(self, 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']))
Example #2
0
 def _assert_sock_open(self, sock):
     # requires the psutil output
     open_files = get_open_files()
     sockname = sock.getsockname()
     for x in open_files['data']:
         if getattr(x, 'laddr', None) == sockname:
             assert x.status in (psutil.CONN_LISTEN, psutil.CONN_ESTABLISHED) + self.extra_allowed_open_states, x.status
             return
     raise AssertionError("%r is not open:\n%s" % (sock, open_files['data']))
Example #3
0
 def _assert_sock_open(self, sock):
     # requires the psutil output
     open_files = get_open_files()
     sockname = sock.getsockname()
     for x in open_files['data']:
         if getattr(x, 'laddr', None) == sockname:
             assert x.status in (psutil.CONN_LISTEN, psutil.CONN_ESTABLISHED) + self.extra_allowed_open_states, x.status
             return
     raise AssertionError("%r is not open:\n%s" % (sock, open_files['data']))
Example #4
0
 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']))
Example #5
0
 def assert_fd_closed(self, 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']))
Example #6
0
 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']))