Commit 3ca42f93 authored by Jason Madden's avatar Jason Madden

Fix test__makefile_ref under Windows 10 with new psutil 4.4 which actually...

Fix test__makefile_ref under Windows 10 with new psutil 4.4 which actually started returning open files, not just connections.
parent 278d7a4f
......@@ -712,6 +712,11 @@ else:
# as -1 there, so we can't fully check those.
def get_open_files():
"""
Return a list of popenfile and pconn objects.
Note that other than `fd`, they have different attributes.
"""
results = dict()
process = psutil.Process()
results['data'] = process.open_files() + process.connections('all')
......
from __future__ import print_function
import os
from gevent import monkey; monkey.patch_all()
import re
......@@ -64,7 +65,7 @@ class Test(unittest.TestCase):
open_files = get_open_files()
sockname = sock.getsockname()
for x in open_files['data']:
if x.laddr == sockname:
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']))
......
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