diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-03-01 18:02:22 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-03-01 18:02:22 +0100 |
commit | 02224268b9b2ebc109a1119405d47d7bede12d65 (patch) | |
tree | e863a72a6c84aefc1ccf22e176c3c8d2fb07af03 | |
parent | 8323a2774d01393fa82d035d89c762a1a0154dba (diff) | |
download | psutil-02224268b9b2ebc109a1119405d47d7bede12d65.tar.gz |
add net_if_stats linux tests
-rw-r--r-- | psutil/tests/test_linux.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 67da1b54..e35d0b5a 100644 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -333,6 +333,17 @@ class TestSystemNetwork(unittest.TestCase): self.assertEqual(addr.address, get_ipv4_address(name)) # TODO: test for AF_INET6 family + def test_net_if_stats(self): + for name, stats in psutil.net_if_stats().items(): + try: + out = sh("ifconfig %s" % name) + except RuntimeError: + pass + else: + self.assertEqual(stats.isup, 'RUNNING' in out) + self.assertEqual(stats.mtu, + int(re.findall('MTU:(\d+)', out)[0])) + @unittest.skipUnless(which('ip'), "'ip' utility not available") @unittest.skipIf(TRAVIS, "skipped on Travis") def test_net_if_names(self): |