From ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Sat, 11 Mar 2023 06:46:20 +0000 Subject: 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 Tested-by: Gavin Mak Commit-Queue: Gavin Mak --- tests/test_platform_utils.py | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'tests/test_platform_utils.py') 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 class RemoveTests(unittest.TestCase): - """Check remove() helper.""" - - def testMissingOk(self): - """Check missing_ok handling.""" - with tempfile.TemporaryDirectory() as tmpdir: - path = os.path.join(tmpdir, 'test') - - # Should not fail. - platform_utils.remove(path, missing_ok=True) - - # Should fail. - self.assertRaises(OSError, platform_utils.remove, path) - self.assertRaises(OSError, platform_utils.remove, path, missing_ok=False) - - # Should not fail if it exists. - open(path, 'w').close() - platform_utils.remove(path, missing_ok=True) - self.assertFalse(os.path.exists(path)) - - open(path, 'w').close() - platform_utils.remove(path) - self.assertFalse(os.path.exists(path)) - - open(path, 'w').close() - platform_utils.remove(path, missing_ok=False) - self.assertFalse(os.path.exists(path)) + """Check remove() helper.""" + + def testMissingOk(self): + """Check missing_ok handling.""" + with tempfile.TemporaryDirectory() as tmpdir: + path = os.path.join(tmpdir, "test") + + # Should not fail. + platform_utils.remove(path, missing_ok=True) + + # Should fail. + self.assertRaises(OSError, platform_utils.remove, path) + self.assertRaises( + OSError, platform_utils.remove, path, missing_ok=False + ) + + # Should not fail if it exists. + open(path, "w").close() + platform_utils.remove(path, missing_ok=True) + self.assertFalse(os.path.exists(path)) + + open(path, "w").close() + platform_utils.remove(path) + self.assertFalse(os.path.exists(path)) + + open(path, "w").close() + platform_utils.remove(path, missing_ok=False) + self.assertFalse(os.path.exists(path)) -- cgit v1.2.3-54-g00ecf