diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-02-02 14:13:27 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-02-02 14:13:27 +0100 |
commit | 11150d2588f47ec4b335ab2ec3591662fc6e88d7 (patch) | |
tree | c058cab4f54abbc250252e10c4b943c7f632b564 | |
parent | 8815aac2673a623dc144474ed20706f9343a704d (diff) | |
download | psutil-11150d2588f47ec4b335ab2ec3591662fc6e88d7.tar.gz |
fix broken test
-rwxr-xr-x | psutil/tests/test_linux.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index f28c70b8..2d659ad1 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -51,7 +51,7 @@ SIOCGIFADDR = 0x8915 SIOCGIFCONF = 0x8912 SIOCGIFHWADDR = 0x8927 if LINUX: - SECTOR_SIZE = psutil._psplatform.SECTOR_SIZE + SECTOR_SIZE = 512 # ===================================================================== @@ -987,7 +987,7 @@ class TestMisc(unittest.TestCase): def open_mock(name, *args, **kwargs): if PY3 and isinstance(name, bytes): name = name.decode() - if name.startswith("/sys/block/sda/queue/hw_sector_size"): + if "hw_sector_size" in name: flag.append(None) raise IOError(errno.ENOENT, '') else: @@ -996,15 +996,9 @@ class TestMisc(unittest.TestCase): flag = [] orig_open = open patch_point = 'builtins.open' if PY3 else '__builtin__.open' - try: - with mock.patch(patch_point, side_effect=open_mock): - importlib.reload(psutil._pslinux) - importlib.reload(psutil) - self.assertEqual(flag, [None]) - self.assertEqual(psutil._pslinux.SECTOR_SIZE, 512) - finally: - importlib.reload(psutil._pslinux) - importlib.reload(psutil) + with mock.patch(patch_point, side_effect=open_mock): + psutil.disk_io_counters() + self.assertTrue(flag) def test_issue_687(self): # In case of thread ID: |