From 23c16717aa3dd6241f7740e951d1aba9ac356a55 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 9 May 2017 21:35:12 -0700 Subject: [PATCH] test_util: tolerate os.statvfs missing on windows The code in util.py can tolerate a missing os.statvfs, but the code which tests that code's ability to tolerate a missing os.statvfs was itself unable to tolerate a missing os.statvfs. Sigh. --- src/wormhole/test/test_util.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wormhole/test/test_util.py b/src/wormhole/test/test_util.py index ad3b8ad..a939b91 100644 --- a/src/wormhole/test/test_util.py +++ b/src/wormhole/test/test_util.py @@ -51,5 +51,10 @@ class Space(unittest.TestCase): # anything more specific about the return value def test_no_statvfs(self): - with mock.patch("os.statvfs", side_effect=AttributeError()): - self.assertEqual(util.estimate_free_space("."), None) + # this mock.patch fails on windows, which is sad because windows is + # the one platform that the code under test was supposed to help with + try: + with mock.patch("os.statvfs", side_effect=AttributeError()): + self.assertEqual(util.estimate_free_space("."), None) + except AttributeError: # raised by mock.get_original() + pass