Fix cros lint errors.
Also move deprecated scripts to the 'deprecated' directory.
BUG=chromiumos:570464
TEST=tested scripts to make sure they still work.
Change-Id: I3442a86d898104591233a0849ea0bafb52ecf1f7
Reviewed-on: https://chrome-internal-review.googlesource.com/244221
Commit-Ready: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
diff --git a/lock_machine_test.py b/lock_machine_test.py
index 7634e2a..0ffe094 100644
--- a/lock_machine_test.py
+++ b/lock_machine_test.py
@@ -4,91 +4,94 @@
MachineManagerTest tests MachineManager.
"""
+from __future__ import print_function
+
__author__ = 'asharif@google.com (Ahmad Sharif)'
from multiprocessing import Process
import time
import unittest
-import lock_machine
+import file_lock_machine
def LockAndSleep(machine):
- lock_machine.Machine(machine, auto=True).Lock(exclusive=True)
+ file_lock_machine.Machine(machine, auto=True).Lock(exclusive=True)
time.sleep(1)
class MachineTest(unittest.TestCase):
+ """Class for testing machine locking."""
def setUp(self):
pass
def testRepeatedUnlock(self):
- mach = lock_machine.Machine('qqqraymes.mtv')
- for i in range(10):
+ mach = file_lock_machine.Machine('qqqraymes.mtv')
+ for _ in range(10):
self.assertFalse(mach.Unlock())
- mach = lock_machine.Machine('qqqraymes.mtv', auto=True)
- for i in range(10):
+ mach = file_lock_machine.Machine('qqqraymes.mtv', auto=True)
+ for _ in range(10):
self.assertFalse(mach.Unlock())
def testLockUnlock(self):
- mach = lock_machine.Machine('otter.mtv', '/tmp')
- for i in range(10):
+ mach = file_lock_machine.Machine('otter.mtv', '/tmp')
+ for _ in range(10):
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine('otter.mtv', '/tmp', True)
- for i in range(10):
+ mach = file_lock_machine.Machine('otter.mtv', '/tmp', True)
+ for _ in range(10):
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
def testSharedLock(self):
- mach = lock_machine.Machine('chrotomation.mtv')
- for i in range(10):
+ mach = file_lock_machine.Machine('chrotomation.mtv')
+ for _ in range(10):
self.assertTrue(mach.Lock(exclusive=False))
- for i in range(10):
+ for _ in range(10):
self.assertTrue(mach.Unlock(exclusive=False))
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine('chrotomation.mtv', auto=True)
- for i in range(10):
+ mach = file_lock_machine.Machine('chrotomation.mtv', auto=True)
+ for _ in range(10):
self.assertTrue(mach.Lock(exclusive=False))
- for i in range(10):
+ for _ in range(10):
self.assertTrue(mach.Unlock(exclusive=False))
self.assertTrue(mach.Lock(exclusive=True))
self.assertTrue(mach.Unlock(exclusive=True))
def testExclusiveLock(self):
- mach = lock_machine.Machine('atree.mtv')
+ mach = file_lock_machine.Machine('atree.mtv')
self.assertTrue(mach.Lock(exclusive=True))
- for i in range(10):
+ for _ 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 = file_lock_machine.Machine('atree.mtv', auto=True)
self.assertTrue(mach.Lock(exclusive=True))
- for i in range(10):
+ for _ in range(10):
self.assertFalse(mach.Lock(exclusive=True))
self.assertFalse(mach.Lock(exclusive=False))
self.assertTrue(mach.Unlock(exclusive=True))
def testExclusiveState(self):
- mach = lock_machine.Machine('testExclusiveState')
+ mach = file_lock_machine.Machine('testExclusiveState')
self.assertTrue(mach.Lock(exclusive=True))
- for i in range(10):
+ for _ in range(10):
self.assertFalse(mach.Lock(exclusive=False))
self.assertTrue(mach.Unlock(exclusive=True))
- mach = lock_machine.Machine('testExclusiveState', auto=True)
+ mach = file_lock_machine.Machine('testExclusiveState', auto=True)
self.assertTrue(mach.Lock(exclusive=True))
- for i in range(10):
+ for _ 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)
+ mach = file_lock_machine.Machine('lockgone', auto=True)
p = Process(target=LockAndSleep, args=('lockgone',))
p.start()
time.sleep(1.1)
@@ -96,7 +99,7 @@
self.assertTrue(mach.Lock(exclusive=True))
def testAutoLockFromOther(self):
- mach = lock_machine.Machine('other_lock', auto=True)
+ mach = file_lock_machine.Machine('other_lock', auto=True)
p = Process(target=LockAndSleep, args=('other_lock',))
p.start()
time.sleep(0.5)
@@ -106,7 +109,7 @@
self.assertTrue(mach.Lock(exclusive=True))
def testUnlockByOthers(self):
- mach = lock_machine.Machine('other_unlock', auto=True)
+ mach = file_lock_machine.Machine('other_unlock', auto=True)
p = Process(target=LockAndSleep, args=('other_unlock',))
p.start()
time.sleep(0.5)