def test_folder_locks(tmpdir):
 package_name = 'dir_1'
 tmpfile = join(tmpdir.strpath, package_name)
 with DirectoryLock(tmpfile) as lock1:
  assert (exists(lock1.lock_file_path) and isfile(lock1.lock_file_path))
  with pytest.raises(LockError) as execinfo:
   with DirectoryLock(tmpfile, retries=1) as lock2:
    assert False
  assert (exists(lock1.lock_file_path) and isfile(lock1.lock_file_path))
 assert (not exists(lock1.lock_file_path))

def test_folder_locks ( tmpdir ) : package_name = 'dir_1' tmpfile = join ( tmpdir . strpath , package_name ) with DirectoryLock ( tmpfile ) as lock1 : assert ( exists ( lock1 . lock_file_path ) and isfile ( lock1 . lock_file_path ) ) with pytest . raises ( LockError ) as execinfo : with DirectoryLock ( tmpfile , retries = 1 ) as lock2 : assert False assert ( exists ( lock1 . lock_file_path ) and isfile ( lock1 . lock_file_path ) ) assert ( not exists ( lock1 . lock_file_path ) )
test on directory lock .