summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-04-28 07:01:25 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-04-28 07:01:25 +0200
commit4ec6c5431f936c31af43d4d2f637e06d2c3b7619 (patch)
tree31d88b4bb235dd57cc1ae11358f373e0c9e1f4e0
parent76dd68eecbcdce608dfc46b37a82f2ab83927b72 (diff)
downloadpsutil-4ec6c5431f936c31af43d4d2f637e06d2c3b7619.tar.gz
minor refactoring
-rwxr-xr-xpsutil/tests/test_system.py3
-rw-r--r--psutil/tests/test_unicode.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index b30d905e..a4d48b8c 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -526,9 +526,10 @@ class TestSystemAPIs(unittest.TestCase):
@skip_on_access_denied()
def test_net_connections(self):
def check(cons, families, types_):
+ AF_UNIX = getattr(socket, 'AF_UNIX', object())
for conn in cons:
self.assertIn(conn.family, families, msg=conn)
- if conn.family != getattr(socket, 'AF_UNIX', object()):
+ if conn.family != AF_UNIX:
self.assertIn(conn.type, types_, msg=conn)
self.assertIsInstance(conn.status, (str, unicode))
diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
index f79131bb..31e29b17 100644
--- a/psutil/tests/test_unicode.py
+++ b/psutil/tests/test_unicode.py
@@ -24,6 +24,7 @@ In psutil these are the APIs returning or dealing with a string:
- disk_io_counters() (not tested)
- disk_partitions() (not tested)
- disk_usage(str)
+- net_connections('unix') (not tested)
- net_if_addrs() (not tested)
- net_if_stats() (not tested)
- net_io_counters() (not tested)
@@ -146,7 +147,7 @@ class _BaseFSAPIsTests(object):
os.path.normcase(self.funky_name))
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "AF_UNIX not supported")
- def test_connections(self):
+ def test_proc_connections(self):
try:
sock, name = bind_unix_socket(suffix=self.funky_name)
except (socket.error, UnicodeEncodeError):