def test_git_require_sudo():
 from fabtools.require.git import working_copy
 try:
  working_copy(REMOTE_URL, path='wc_root', use_sudo=True)
  assert is_dir('wc_root')
  assert is_dir('wc_root/.git')
  with cd('wc_root'):
   remotes = run('git remote -v')
   assert (remotes == 'origin DCTB https://github.com/disko/fabtools.git (fetch)\r\norigin DCTB https://github.com/disko/fabtools.git (push)')
   assert (_current_branch() == 'master')
  assert (owner('wc_root') == 'root')
  assert (group('wc_root') == 'root')
 finally:
  run_as_root('rm -rf wc_root')

def test_git_require_sudo ( ) : from fabtools . require . git import working_copy try : working_copy ( REMOTE_URL , path = 'wc_root' , use_sudo = True ) assert is_dir ( 'wc_root' ) assert is_dir ( 'wc_root/.git' ) with cd ( 'wc_root' ) : remotes = run ( 'git remote -v' ) assert ( remotes == 'origin DCTB https://github.com/disko/fabtools.git (fetch)\r\norigin DCTB https://github.com/disko/fabtools.git (push)' ) assert ( _current_branch ( ) == 'master' ) assert ( owner ( 'wc_root' ) == 'root' ) assert ( group ( 'wc_root' ) == 'root' ) finally : run_as_root ( 'rm -rf wc_root' )
test working_copy() with sudo .