summaryrefslogtreecommitdiffstats
path: root/tests/test_platform_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_platform_utils.py')
-rw-r--r--tests/test_platform_utils.py54
1 files changed, 28 insertions, 26 deletions
diff --git a/tests/test_platform_utils.py b/tests/test_platform_utils.py
index 55b7805c..7a42de01 100644
--- a/tests/test_platform_utils.py
+++ b/tests/test_platform_utils.py
@@ -22,29 +22,31 @@ import platform_utils
22 22
23 23
24class RemoveTests(unittest.TestCase): 24class RemoveTests(unittest.TestCase):
25 """Check remove() helper.""" 25 """Check remove() helper."""
26 26
27 def testMissingOk(self): 27 def testMissingOk(self):
28 """Check missing_ok handling.""" 28 """Check missing_ok handling."""
29 with tempfile.TemporaryDirectory() as tmpdir: 29 with tempfile.TemporaryDirectory() as tmpdir:
30 path = os.path.join(tmpdir, 'test') 30 path = os.path.join(tmpdir, "test")
31 31
32 # Should not fail. 32 # Should not fail.
33 platform_utils.remove(path, missing_ok=True) 33 platform_utils.remove(path, missing_ok=True)
34 34
35 # Should fail. 35 # Should fail.
36 self.assertRaises(OSError, platform_utils.remove, path) 36 self.assertRaises(OSError, platform_utils.remove, path)
37 self.assertRaises(OSError, platform_utils.remove, path, missing_ok=False) 37 self.assertRaises(
38 38 OSError, platform_utils.remove, path, missing_ok=False
39 # Should not fail if it exists. 39 )
40 open(path, 'w').close() 40
41 platform_utils.remove(path, missing_ok=True) 41 # Should not fail if it exists.
42 self.assertFalse(os.path.exists(path)) 42 open(path, "w").close()
43 43 platform_utils.remove(path, missing_ok=True)
44 open(path, 'w').close() 44 self.assertFalse(os.path.exists(path))
45 platform_utils.remove(path) 45
46 self.assertFalse(os.path.exists(path)) 46 open(path, "w").close()
47 47 platform_utils.remove(path)
48 open(path, 'w').close() 48 self.assertFalse(os.path.exists(path))
49 platform_utils.remove(path, missing_ok=False) 49
50 self.assertFalse(os.path.exists(path)) 50 open(path, "w").close()
51 platform_utils.remove(path, missing_ok=False)
52 self.assertFalse(os.path.exists(path))