def test_main_function(self):
# List files
file_list = [os.path.join(test_fold, f) for f in self._input_files]
# Output to string
with io.StringIO() as io_stream:
sys.stdout = io_stream
hpp2plantuml.CreatePlantUMLFile(file_list)
io_stream.seek(0)
# Read string output, exclude final line return
output_str = io_stream.read()[:-1]
sys.stdout = sys.__stdout__
nt.assert_equal(self._diag_saved_ref, output_str)
# Output to file
output_fname = 'output.puml'
hpp2plantuml.CreatePlantUMLFile(file_list, output_fname)
output_fcontent = ''
with open(output_fname, 'rt') as fid:
output_fcontent = fid.read()
nt.assert_equal(self._diag_saved_ref, output_fcontent)
os.unlink(output_fname)
评论列表
文章目录