Ejemplo n.º 1
0
 def test_enter_contex_manager(self):
     with locks.DirectoryLock(self.path) as lock:
         self.assertEqual(lock.locked, True)
         self.assertEqual(
             os.path.isfile(lock.filename),
             True,
         )
Ejemplo n.º 2
0
 def test_exit_contex_manager(self):
     context_manager = locks.DirectoryLock(self.path)
     lock = context_manager.__enter__()
     lock.__exit__(None, None, None)
     self.assertEqual(lock.locked, False)
     self.assertEqual(
         os.path.isfile(lock.filename),
         False,
     )
Ejemplo n.º 3
0
 def setUp(self):
     self.path = tempfile.mkdtemp()
     self.lock = locks.DirectoryLock(self.path)