Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues.
Ran by doing this:
for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i
--remove_trailing_comma --yapf --force_quote_type=double $f ; else
pyformat -i --remove_shebang --remove_trailing_comma --yapf
--force_quote_type=double $f ; fi ; done
BUG=chromium:567921
TEST=Ran simple crosperf run.
Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1
Reviewed-on: https://chrome-internal-review.googlesource.com/242031
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
diff --git a/lock_machine_test.py b/lock_machine_test.py
index d61878b..7634e2a 100644
--- a/lock_machine_test.py
+++ b/lock_machine_test.py
@@ -1,13 +1,10 @@
-#!/usr/bin/python
-#
# Copyright 2010 Google Inc. All Rights Reserved.
-
"""lock_machine.py related unit-tests.
MachineManagerTest tests MachineManager.
"""
-__author__ = "asharif@google.com (Ahmad Sharif)"
+__author__ = 'asharif@google.com (Ahmad Sharif)'
from multiprocessing import Process
import time
@@ -22,30 +19,31 @@
class MachineTest(unittest.TestCase):
+
def setUp(self):
pass
def testRepeatedUnlock(self):
- mach = lock_machine.Machine("qqqraymes.mtv")
+ mach = lock_machine.Machine('qqqraymes.mtv')
for i in range(10):
self.assertFalse(mach.Unlock())
- mach = lock_machine.Machine("qqqraymes.mtv", auto=True)
+ mach = lock_machine.Machine('qqqraymes.mtv', auto=True)
for i in range(10):
self.assertFalse(mach.Unlock())
def testLockUnlock(self):
- mach = lock_machine.Machine("otter.mtv", "/tmp")
+ mach = lock_machine.Machine('otter.mtv', '/tmp')
for i in range(10):
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine("otter.mtv", "/tmp", True)
+ mach = lock_machine.Machine('otter.mtv', '/tmp', True)
for i in range(10):
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
def testSharedLock(self):
- mach = lock_machine.Machine("chrotomation.mtv")
+ mach = lock_machine.Machine('chrotomation.mtv')
for i in range(10):
self.assertTrue(mach.Lock(exclusive=False))
for i in range(10):
@@ -53,7 +51,7 @@
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine("chrotomation.mtv", auto=True)
+ mach = lock_machine.Machine('chrotomation.mtv', auto=True)
for i in range(10):
self.assertTrue(mach.Lock(exclusive=False))
for i in range(10):
@@ -62,14 +60,14 @@
self.assertTrue(mach.Unlock(exclusive=True))
def testExclusiveLock(self):
- mach = lock_machine.Machine("atree.mtv")
+ mach = lock_machine.Machine('atree.mtv')
self.assertTrue(mach.Lock(exclusive=True))
for i in range(10):
self.assertFalse(mach.Lock(exclusive=True))
self.assertFalse(mach.Lock(exclusive=False))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine("atree.mtv", auto=True)
+ mach = lock_machine.Machine('atree.mtv', auto=True)
self.assertTrue(mach.Lock(exclusive=True))
for i in range(10):
self.assertFalse(mach.Lock(exclusive=True))
@@ -77,29 +75,29 @@
self.assertTrue(mach.Unlock(exclusive=True))
def testExclusiveState(self):
- mach = lock_machine.Machine("testExclusiveState")
+ mach = lock_machine.Machine('testExclusiveState')
self.assertTrue(mach.Lock(exclusive=True))
for i in range(10):
self.assertFalse(mach.Lock(exclusive=False))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine("testExclusiveState", auto=True)
+ mach = lock_machine.Machine('testExclusiveState', auto=True)
self.assertTrue(mach.Lock(exclusive=True))
for i in range(10):
self.assertFalse(mach.Lock(exclusive=False))
self.assertTrue(mach.Unlock(exclusive=True))
def testAutoLockGone(self):
- mach = lock_machine.Machine("lockgone", auto=True)
- p = Process(target=LockAndSleep, args=("lockgone",))
+ mach = lock_machine.Machine('lockgone', auto=True)
+ p = Process(target=LockAndSleep, args=('lockgone',))
p.start()
time.sleep(1.1)
p.join()
self.assertTrue(mach.Lock(exclusive=True))
def testAutoLockFromOther(self):
- mach = lock_machine.Machine("other_lock", auto=True)
- p = Process(target=LockAndSleep, args=("other_lock",))
+ mach = lock_machine.Machine('other_lock', auto=True)
+ p = Process(target=LockAndSleep, args=('other_lock',))
p.start()
time.sleep(0.5)
self.assertFalse(mach.Lock(exclusive=True))
@@ -108,13 +106,13 @@
self.assertTrue(mach.Lock(exclusive=True))
def testUnlockByOthers(self):
- mach = lock_machine.Machine("other_unlock", auto=True)
- p = Process(target=LockAndSleep, args=("other_unlock",))
+ mach = lock_machine.Machine('other_unlock', auto=True)
+ p = Process(target=LockAndSleep, args=('other_unlock',))
p.start()
time.sleep(0.5)
self.assertTrue(mach.Unlock(exclusive=True))
self.assertTrue(mach.Lock(exclusive=True))
-if __name__ == "__main__":
+if __name__ == '__main__':
unittest.main()