def runTest(self): # Write the same contents twice assert write_file(self._get_test_file_name(), 'hello') assert not write_file(self._get_test_file_name(), 'hello') assert not write_file(self._get_test_file_name(), 'hello') self.tearDown() # Write the same contents twice, only differing with righthand padding assert write_file(self._get_test_file_name(), 'hello \nworld') assert not write_file(self._get_test_file_name(), 'hello\nworld') self.tearDown() # Write a sequence of lines assert write_file(self._get_test_file_name(), ('hello', 'world')) assert not write_file(self._get_test_file_name(), 'hello\nworld') self.tearDown() # Write A B A assert write_file(self._get_test_file_name(), 'hello') assert write_file(self._get_test_file_name(), 'hellox') assert write_file(self._get_test_file_name(), 'hello') self.tearDown() # Write with force=True assert write_file(self._get_test_file_name(), 'hello') assert write_file(self._get_test_file_name(), 'hello', force=True) self.tearDown() # Write a non-string, non-sequence assert write_file(self._get_test_file_name(), 1) assert not write_file(self._get_test_file_name(), '1') self.tearDown()
source_files = source_files.exclude('ygi.h') cpp.append(source_files.get_combined_repr()) project_dist_dir_path = \ path_join(YIELD_ROOT_DIR_PATH, 'dist')#, path_sep.join(project_name.split('.'))) if not exists(project_dist_dir_path): makedirs(project_dist_dir_path) for file_ext in ('cpp', 'hpp'): file_path = \ path_join( project_dist_dir_path, '_'.join(project_name.split('.')) + '.' + file_ext ) write_file(file_path, locals()[file_ext], force=options.force) if ypy_dir_path is not None: ypy_file_path = \ path_join( ypy_dir_path, 'share', 'yield', 'dist', #path_sep.join(project_name.split('.')), path_split(file_path)[1] ) if exists(ypy_file_path): copy_file(file_path, ypy_file_path)