def test_filelock_locks(tmpdir):
 package_name = 'conda_file_2'
 tmpfile = join(tmpdir.strpath, package_name)
 with FileLock(tmpfile) as lock1:
  path = basename(lock1.lock_file_path)
  assert tmpdir.join(path).exists()
  with pytest.raises(LockError) as execinfo:
   with FileLock(tmpfile, retries=1) as lock2:
    assert False
   assert (lock2.path_to_lock == lock1.path_to_lock)
  assert (tmpdir.join(path).exists() and tmpdir.join(path).isfile())
 assert (not tmpdir.join(path).exists())

def test_filelock_locks ( tmpdir ) : package_name = 'conda_file_2' tmpfile = join ( tmpdir . strpath , package_name ) with FileLock ( tmpfile ) as lock1 : path = basename ( lock1 . lock_file_path ) assert tmpdir . join ( path ) . exists ( ) with pytest . raises ( LockError ) as execinfo : with FileLock ( tmpfile , retries = 1 ) as lock2 : assert False assert ( lock2 . path_to_lock == lock1 . path_to_lock ) assert ( tmpdir . join ( path ) . exists ( ) and tmpdir . join ( path ) . isfile ( ) ) assert ( not tmpdir . join ( path ) . exists ( ) )
test on file lock .