def test_require_file_from_local_file():
 from fabtools.require import file as require_file
 try:
  baz_contents = 'This is the contents of the bar file'
  (fd, filename) = mkstemp()
  tmp_file = os.fdopen(fd, 'w')
  tmp_file.write(baz_contents)
  tmp_file.close()
  require_file('baz', source=filename)
  assert is_file('baz')
  assert (run('cat baz') == baz_contents)
 finally:
  os.remove(filename)
  run('rm -f baz')

def test_require_file_from_local_file ( ) : from fabtools . require import file as require_file try : baz_contents = 'This is the contents of the bar file' ( fd , filename ) = mkstemp ( ) tmp_file = os . fdopen ( fd , 'w' ) tmp_file . write ( baz_contents ) tmp_file . close ( ) require_file ( 'baz' , source = filename ) assert is_file ( 'baz' ) assert ( run ( 'cat baz' ) == baz_contents ) finally : os . remove ( filename ) run ( 'rm -f baz' )
require that a file exists .