def test_pushd(): original_dir = os.getcwd() with utils.pushd('/tmp'): new_dir = os.getcwd() assert new_dir == '/tmp' current_dir = os.getcwd() assert current_dir == original_dir
def each_num_dir(self): if not os.path.isdir(self.working_dir): ValueError('working_dir does not exist.') count = 1 for package_dict in self._recipe.each_normalized_package(): num_name = self.num_name_from_count(count) num_dir = os.path.join(self.working_dir, num_name) if not os.path.isdir(num_dir): os.makedirs(num_dir) with utils.pushd(num_dir): yield package_dict, num_name count += 1
def each_package_dir(self): for package_dict, num_name in self.each_num_dir(): package = package_dict['name'] with utils.pushd(package): yield package_dict, num_name