Exemple #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,
         )
Exemple #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,
     )
Exemple #3
0
 def setUp(self):
     self.path = tempfile.mkdtemp()
     self.lock = locks.DirectoryLock(self.path)