def temp_copy(self): """Yields a new Vcs object that represents a temporary, disposable copy of the current repository. The copy is deleted at the end of the context. The following are not copied: - ignored files - easyci private directory (.git/eci for git) Yields: Vcs """ with contextmanagers.temp_dir() as temp_dir: temp_root_path = os.path.join(temp_dir, "root") path = os.path.join(self.path, "") # adds trailing slash check_call( [ "rsync", "-r", "--exclude={}".format(self.private_dir()), "--filter=dir-merge,- {}".format(self.ignore_patterns_file()), path, temp_root_path, ] ) copy = self.__class__(path=temp_root_path) yield copy
def temp_copy(self): """Yields a new Vcs object that represents a temporary, disposable copy of the current repository. The copy is deleted at the end of the context. The following are not copied: - ignored files - easyci private directory (.git/eci for git) Yields: Vcs """ with contextmanagers.temp_dir() as temp_dir: temp_root_path = os.path.join(temp_dir, 'root') path = os.path.join(self.path, '') # adds trailing slash check_call([ 'rsync', '-r', "--exclude={}".format(self.private_dir()), "--filter=dir-merge,- {}".format(self.ignore_patterns_file()), path, temp_root_path ]) copy = self.__class__(path=temp_root_path) yield copy
def vcs(): with contextmanagers.temp_dir() as temp_dir: os.makedirs(os.path.join(temp_dir, '.dummy/eci')) yield DummyVcs(path=temp_dir)
def temp_path(): with contextmanagers.temp_dir() as temp_dir: yield temp_dir
def temp_path(): with contextmanagers.temp_dir() as temp: with contextmanagers.chdir(temp): yield temp
def repo_path(): with contextmanagers.temp_dir() as temp_dir: os.mkdir(os.path.join(temp_dir, '.git')) yield temp_dir
def vcs(): with contextmanagers.temp_dir() as temp_dir: os.makedirs(os.path.join(temp_dir, '.dummy/eci')) yield DummyVcs(path=temp_dir)
def test_temp_dir(): with contextmanagers.temp_dir() as temp_dir: assert os.path.exists(temp_dir) assert os.path.isdir(temp_dir) assert not os.path.exists(temp_dir)
def temp_path(): with contextmanagers.temp_dir() as temp: with contextmanagers.chdir(temp): yield temp
def temp_path(): with contextmanagers.temp_dir() as temp_dir: yield temp_dir