提交 cba67d6a 编写于 作者: T tomtao 提交者: Gitee

复原view代码,修改test读取excel引擎

上级 e0166ae2
......@@ -67,13 +67,11 @@ class DownloadFile(Resource):
"""
try:
bytes_io = io.BytesIO()
with pd.ExcelWriter(bytes_io, engine='xlsxwriter') as writer:
data_frame.to_excel(writer, sheet_name='Summary', index=False)
# writer = pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
# bytes_io, engine='xlsxwrite')
# data_frame.to_excel(writer, sheet_name='Summary', index=False)
# writer.save()
# writer.close()
writer = pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
bytes_io, engine='xlsxwriter')
data_frame.to_excel(writer, sheet_name='Summary', index=False)
writer.save()
writer.close()
bytes_io.seek(0)
_response = make_response(bytes_io.getvalue())
bytes_io.close()
......
......@@ -44,7 +44,7 @@ class TestDownloadExcelFile(ReadTestBase):
"""
response = self.client.get("/lifeCycle/download/issues")
data_frame = pd.read_excel(
response.data, sheet_name='Summary')
response.data, sheet_name='Summary',engine='xlrd')
datas = data_frame.values.tolist()
self.assertEqual(
14, len(datas), msg="An error occurred in the downloaded data")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册