summaryrefslogtreecommitdiffstats
path: root/tests/test_platform_utils.py
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2023-03-11 06:46:20 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-22 17:46:28 +0000
commitea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 (patch)
treedc33ba0e56825b3e007d0589891756724725a465 /tests/test_platform_utils.py
parent1604cf255f8c1786a23388db6d5277ac7949a24a (diff)
downloadgit-repo-ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1.tar.gz
Format codebase with black and check formatting in CQ
Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
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))