testing/run_with_dummy_home.py
def _set_up_dummy_home(original_home, dummy_home):
  """Sets up a dummy $HOME that Chromium tests can run in.

  Files are copied, while directories are symlinked.
  """
  for filename in ['.Xauthority']:
    original_path = os.path.join(original_home, filename)
    if not os.path.exists(original_path):
      continue
    shutil.copyfile(original_path, os.path.join(dummy_home, filename))

  # Prevent fontconfig etc. from reconstructing the cache and symlink rr
  # trace directory.
  for dirpath in [['.cache'], ['.local', 'share', 'rr'], ['.vpython'],
                  ['.vpython_cipd_cache'], ['.vpython-root']]:
    original_path = os.path.join(original_home, *dirpath)
    if not os.path.exists(original_path):
      continue
    dummy_parent_path = os.path.join(dummy_home, *dirpath[:-1])
    if not os.path.isdir(dummy_parent_path):
      os.makedirs(dummy_parent_path)
    os.symlink(original_path, os.path.join(dummy_home, *dirpath))
Sets up a dummy $HOME that Chromium tests can run in.

  Files are copied, while directories are symlinked.
  
Sets up a dummy $HOME that Chromium tests can run in.
Files are copied, while directories are symlinked.
Sets up a dummy $HOME that Chromium tests can run in . Files are copied while directories are symlinked .
def _set_up_dummy_home(original_home, dummy_home):
  for filename in ['.Xauthority']:
    original_path = os.path.join(original_home, filename)
    if not os.path.exists(original_path):
      continue
    shutil.copyfile(original_path, os.path.join(dummy_home, filename))
  for dirpath in [['.cache'], ['.local', 'share', 'rr'], ['.vpython'],
                  ['.vpython_cipd_cache'], ['.vpython-root']]:
    original_path = os.path.join(original_home, *dirpath)
    if not os.path.exists(original_path):
      continue
    dummy_parent_path = os.path.join(dummy_home, *dirpath[:-1])
    if not os.path.isdir(dummy_parent_path):
      os.makedirs(dummy_parent_path)
    os.symlink(original_path, os.path.join(dummy_home, *dirpath))
def _set_up_dummy_home ( original_home , dummy_home ) : for filename in [ '.Xauthority' ] : original_path = os . path . join ( original_home , filename ) if not os . path . exists ( original_path ) : continue shutil . copyfile ( original_path , os . path . join ( dummy_home , filename ) ) for dirpath in [ [ '.cache' ] , [ '.local' , 'share' , 'rr' ] , [ '.vpython' ] , [ '.vpython_cipd_cache' ] , [ '.vpython-root' ] ] : original_path = os . path . join ( original_home , * dirpath ) if not os . path . exists ( original_path ) : continue dummy_parent_path = os . path . join ( dummy_home , * dirpath [ : - 1 ] ) if not os . path . isdir ( dummy_parent_path ) : os . makedirs ( dummy_parent_path ) os . symlink ( original_path , os . path . join ( dummy_home , * dirpath ) )
Sets up a dummy $HOME that Chromium tests can run in.
Sets up a dummy $HOME that Chromium tests can run in .
"""Sets up a dummy $HOME that Chromium tests can run in.

  Files are copied, while directories are symlinked.
  """ # Prevent fontconfig etc. from reconstructing the cache and symlink rr # trace directory.
original_home
dummy_home