Skip to content

Commit

Permalink
return zipped report path
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Dec 20, 2024
1 parent 1f93af8 commit 53a3557
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pipestat/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_all_result_files(results_file_path: str) -> List:
return files


def zip_report(report_dir_name: str):
def zip_report(report_dir_name: str) -> Union[str, None]:
"""
Walks through files and attempts to zip them into a Zip object using default compression.
Expand All @@ -203,5 +203,7 @@ def zip_report(report_dir_name: str):

if os.path.exists(zip_file_name + ".zip"):
_LOGGER.info(f"Report zip file successfully created: {zip_file_name}.zip")
return f"{zip_file_name}.zip"
else:
_LOGGER.warning("Report zip file not created.")
return None
2 changes: 1 addition & 1 deletion pipestat/pipestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def summarize(
)

if portable is True:
zip_report(report_dir_name=os.path.dirname(report_path))
report_path = zip_report(report_dir_name=os.path.dirname(report_path))

return report_path

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pipestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ def test_zip_html_report_portable(
htmlreportpath = psm.summarize(amendment="", portable=True)

directory = os.path.dirname(htmlreportpath)
zip_files = glob.glob(directory + "*.zip")
zip_files = glob.glob(directory)

assert len(zip_files) > 0

Expand Down

0 comments on commit 53a3557

Please sign in to comment.