@contextlib.contextmanager
def temp_git_commit_file():
 basedir = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.pardir, os.pardir)
 path = os.path.join(basedir, 'qutebrowser', 'git-commit-id')
 with open(path, 'wb') as f:
  f.write('fake-frozen-git-commit')
 (yield)
 os.remove(path)

@ contextlib . contextmanager def temp_git_commit_file ( ) : basedir = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , os . path . pardir , os . pardir ) path = os . path . join ( basedir , 'qutebrowser' , 'git-commit-id' ) with open ( path , 'wb' ) as f : f . write ( 'fake-frozen-git-commit' ) ( yield ) os . remove ( path )
context manager to temporarily create a fake git-commit-id file .