Skip to content

Commit

Permalink
#2408: fix some tests which were still failing due to the old name
Browse files Browse the repository at this point in the history
Signed-off-by: Giampaolo Rodola <[email protected]>
  • Loading branch information
giampaolo committed Apr 18, 2024
1 parent 20ed8f9 commit 8bfecf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,9 +1207,9 @@ def test_as_dict(self):
self.assertEqual(sorted(d.keys()), ['exe', 'name'])

p = psutil.Process(min(psutil.pids()))
d = p.as_dict(attrs=['connections'], ad_value='foo')
if not isinstance(d['connections'], list):
self.assertEqual(d['connections'], 'foo')
d = p.as_dict(attrs=['net_connections'], ad_value='foo')
if not isinstance(d['net_connections'], list):
self.assertEqual(d['net_connections'], 'foo')

# Test ad_value is set on AccessDenied.
with mock.patch(
Expand Down
4 changes: 2 additions & 2 deletions scripts/procinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ def run(pid, verbose=False):
else:
print_('open-files', '')

if pinfo['connections']:
if pinfo['net_connections']:
template = '%-5s %-25s %-25s %s'
print_(
'connections',
template % ('PROTO', 'LOCAL ADDR', 'REMOTE ADDR', 'STATUS'),
)
for conn in pinfo['connections']:
for conn in pinfo['net_connections']:
if conn.type == socket.SOCK_STREAM:
type = 'TCP'
elif conn.type == socket.SOCK_DGRAM:
Expand Down

0 comments on commit 8bfecf0

Please sign in to comment.