Skip to content

Commit

Permalink
test_anonymize_file_not_found error_msg, macobuild create-dmg edit
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevans committed Oct 30, 2024
1 parent 0e7b047 commit 0787c27
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, macos-13]
os: [windows-2022, windows-latest, macos-13, macos-latest]

steps:
- name: Checkout repository
Expand Down
30 changes: 26 additions & 4 deletions src/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pipenv shell
# python build.py

import os, sys
import os, sys, time
import shutil
import subprocess
import platform
Expand Down Expand Up @@ -131,6 +131,16 @@ def set_macos_version(bundle_path, version):

elif platform.system() == "Darwin":

if os.path.exists("dist"):
print(f"Deleting dist folder")
shutil.rmtree("dist")
time.sleep(1)

if os.path.exists("dmg"):
print(f"Deleting dmg folder")
shutil.rmtree("dmg")
time.sleep(1)

PyInstaller.__main__.run(
[
"--noconfirm",
Expand All @@ -142,7 +152,7 @@ def set_macos_version(bundle_path, version):
"assets:assets",
"--collect-all",
"easyocr",
"--strip",
# "--strip",
"--log-level",
"INFO",
"--icon",
Expand Down Expand Up @@ -177,20 +187,32 @@ def set_macos_version(bundle_path, version):
print(f"Creating DMG file for {build_version_name}")
dmg_path = f"dmg/{build_version_name}.dmg"
result = subprocess.run(
["create-dmg", "--app-drop-link", "600", "185", "--skip-jenkins", "--hdiutil-quiet", dmg_path, bundle_path],
[
"create-dmg",
"--app-drop-link",
"600",
"185",
"--skip-jenkins",
dmg_path,
bundle_path,
], # "--hdiutil-quiet", dmg_path, bundle_path],
capture_output=True,
text=True,
)

if result.returncode != 0:
print(f"create-dmg command failed with error code {result.returncode}")
print(f"Error: {result}")
# sys.exit(1)
sys.exit(1)

time.sleep(1)

# Delete the dist folder
print(f"Deleting dist folder")
shutil.rmtree("dist")

time.sleep(1)

# Rename the "dmg" directory to "dist"
os.rename("dmg", "dist")

Expand Down
4 changes: 1 addition & 3 deletions tests/controller/test_anonymize.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,9 @@ def test_anonymize_file_not_found(temp_dir: str, controller: ProjectController):
error_msg, ds = anonymizer.anonymize_file(Path(temp_dir))

assert error_msg
assert "Is a directory" in error_msg
assert error_msg in ["Is a directory", "Permission denied", "Errno 13"]
assert ds is None

# TODO: simulate file permission error


def test_anonymize_invalid_dicom_file(temp_dir: str, controller: ProjectController):
anonymizer: AnonymizerController = controller.anonymizer
Expand Down

0 comments on commit 0787c27

Please sign in to comment.