|
@@ -31,7 +31,12 @@ def tmp_excel_file():
|
|
def cleanup(tmp_excel_file):
|
|
def cleanup(tmp_excel_file):
|
|
yield
|
|
yield
|
|
if os.path.exists(tmp_excel_file):
|
|
if os.path.exists(tmp_excel_file):
|
|
- os.remove(tmp_excel_file)
|
|
|
|
|
|
+ try:
|
|
|
|
+ os.remove(tmp_excel_file)
|
|
|
|
+ except Exception as e:
|
|
|
|
+ from taipy.logger._taipy_logger import _TaipyLogger
|
|
|
|
+ logger = _TaipyLogger._get_logger()
|
|
|
|
+ logger.error(f"Failed to delete {tmp_excel_file}. {e}")
|
|
|
|
|
|
|
|
|
|
@dataclasses.dataclass
|
|
@dataclasses.dataclass
|
|
@@ -167,7 +172,6 @@ def test_write_with_header_multiple_sheet_custom_exposed_type_with_sheet_name(tm
|
|
Scope.SCENARIO,
|
|
Scope.SCENARIO,
|
|
properties={"path": tmp_excel_file, "sheet_name": sheet_names, "exposed_type": MyCustomObject},
|
|
properties={"path": tmp_excel_file, "sheet_name": sheet_names, "exposed_type": MyCustomObject},
|
|
)
|
|
)
|
|
-
|
|
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|
|
row_2 = [MyCustomObject(0, 4, "hello"), MyCustomObject(1, 5, "abc"), MyCustomObject(2, 6, ".")]
|
|
row_2 = [MyCustomObject(0, 4, "hello"), MyCustomObject(1, 5, "abc"), MyCustomObject(2, 6, ".")]
|
|
sheet_data = {"Sheet1": row_1, "Sheet2": row_2}
|
|
sheet_data = {"Sheet1": row_1, "Sheet2": row_2}
|
|
@@ -180,7 +184,10 @@ def test_write_with_header_multiple_sheet_custom_exposed_type_with_sheet_name(tm
|
|
|
|
|
|
|
|
|
|
def test_write_with_header_multiple_sheet_custom_exposed_type_without_sheet_name(tmp_excel_file):
|
|
def test_write_with_header_multiple_sheet_custom_exposed_type_without_sheet_name(tmp_excel_file):
|
|
- excel_dn = ExcelDataNode("foo", Scope.SCENARIO, properties={"path": tmp_excel_file, "exposed_type": MyCustomObject})
|
|
|
|
|
|
+ excel_dn = ExcelDataNode(
|
|
|
|
+ "foo",
|
|
|
|
+ Scope.SCENARIO,
|
|
|
|
+ properties={"path": tmp_excel_file, "exposed_type": MyCustomObject})
|
|
|
|
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|
|
row_2 = [MyCustomObject(0, 4, "hello"), MyCustomObject(1, 5, "abc"), MyCustomObject(2, 6, ".")]
|
|
row_2 = [MyCustomObject(0, 4, "hello"), MyCustomObject(1, 5, "abc"), MyCustomObject(2, 6, ".")]
|
|
@@ -195,7 +202,9 @@ def test_write_with_header_multiple_sheet_custom_exposed_type_without_sheet_name
|
|
|
|
|
|
def test_write_without_header_multiple_sheet_pandas_with_sheet_name(tmp_excel_file):
|
|
def test_write_without_header_multiple_sheet_pandas_with_sheet_name(tmp_excel_file):
|
|
excel_dn = ExcelDataNode(
|
|
excel_dn = ExcelDataNode(
|
|
- "foo", Scope.SCENARIO, properties={"path": tmp_excel_file, "sheet_name": sheet_names, "has_header": False}
|
|
|
|
|
|
+ "foo",
|
|
|
|
+ Scope.SCENARIO,
|
|
|
|
+ properties={"path": tmp_excel_file, "sheet_name": sheet_names, "has_header": False}
|
|
)
|
|
)
|
|
|
|
|
|
df_1 = pd.DataFrame([*zip([1, 2, 3])])
|
|
df_1 = pd.DataFrame([*zip([1, 2, 3])])
|
|
@@ -283,7 +292,9 @@ def test_write_without_header_multiple_sheet_numpy_with_sheet_name(tmp_excel_fil
|
|
|
|
|
|
def test_write_without_header_multiple_sheet_numpy_without_sheet_name(tmp_excel_file):
|
|
def test_write_without_header_multiple_sheet_numpy_without_sheet_name(tmp_excel_file):
|
|
excel_dn = ExcelDataNode(
|
|
excel_dn = ExcelDataNode(
|
|
- "foo", Scope.SCENARIO, properties={"path": tmp_excel_file, "exposed_type": "numpy", "has_header": False}
|
|
|
|
|
|
+ "foo",
|
|
|
|
+ Scope.SCENARIO,
|
|
|
|
+ properties={"path": tmp_excel_file, "exposed_type": "numpy", "has_header": False}
|
|
)
|
|
)
|
|
|
|
|
|
arr_1 = np.array([[1], [2], [3]])
|
|
arr_1 = np.array([[1], [2], [3]])
|
|
@@ -332,7 +343,9 @@ def test_write_without_header_multiple_sheet_custom_exposed_type_with_sheet_name
|
|
|
|
|
|
def test_write_without_header_multiple_sheet_custom_exposed_type_without_sheet_name(tmp_excel_file):
|
|
def test_write_without_header_multiple_sheet_custom_exposed_type_without_sheet_name(tmp_excel_file):
|
|
excel_dn = ExcelDataNode(
|
|
excel_dn = ExcelDataNode(
|
|
- "foo", Scope.SCENARIO, properties={"path": tmp_excel_file, "exposed_type": MyCustomObject, "has_header": False}
|
|
|
|
|
|
+ "foo",
|
|
|
|
+ Scope.SCENARIO,
|
|
|
|
+ properties={"path": tmp_excel_file, "exposed_type": MyCustomObject, "has_header": False}
|
|
)
|
|
)
|
|
|
|
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|
|
row_1 = [MyCustomObject(0, 1, "hi"), MyCustomObject(1, 2, "world"), MyCustomObject(2, 3, "text")]
|