From 49d437962577f3460c6d61d9dc2c276d429d5999 Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Mon, 29 Apr 2024 14:00:52 +0100 Subject: [PATCH 01/14] Unzip ibsolution file: --- cicd/migration_helpers.py | 15 ++++++++++++--- cicd/promote_solution.py | 8 ++++++-- requirements.txt | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 49905c1..4c4b456 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -1,9 +1,11 @@ -import requests import logging import json import os import time +import requests +import zipfile + from ib_helpers import upload_chunks, read_file_through_api, package_solution, unzip_files, compile_solution, \ copy_file_within_ib, read_file_content_from_ib, get_file_metadata, create_folder_if_it_does_not_exists, \ wait_until_job_finishes @@ -98,7 +100,7 @@ def compile_and_package_ib_solution(ib_host, api_token, solution_directory_path, return compile_resp, solution_resp -def download_ibsolution(ib_host, api_token, solution_path, write_to_local=True): +def download_ibsolution(ib_host, api_token, solution_path, write_to_local=True, unzip_solution=True): """ Get the bytes content of an .ibsolution file @@ -110,13 +112,20 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=True): """ # TODO: Check if file exists first - # Read in .ibsolution file resp = read_file_through_api(ib_host, api_token, solution_path) if write_to_local: with open(solution_path.split('/')[-1], 'wb') as fd: fd.write(resp.content) + if unzip_solution: + zip_path = solution_path.split('/')[-1].replace('ibsolution', 'zip') + with open(zip_path, 'wb') as fd: + fd.write(resp.content) + with zipfile.ZipFile(zip_path, "r") as zip_ref: + zip_ref.extractall(zip_path[:-4]) + os.remove(zip_path) + return resp diff --git a/cicd/promote_solution.py b/cicd/promote_solution.py index 0da4926..b76d324 100644 --- a/cicd/promote_solution.py +++ b/cicd/promote_solution.py @@ -15,6 +15,10 @@ from migration_helpers import download_ibsolution, compile_and_package_ib_solution, \ download_dependencies_from_dev_and_upload_to_prod +from dotenv import load_dotenv + +load_dotenv() + TARGET_IB_API_TOKEN = os.environ.get('TARGET_IB_API_TOKEN') SOURCE_IB_API_TOKEN = os.environ.get('SOURCE_IB_API_TOKEN') @@ -166,7 +170,7 @@ def copy_solution_to_working_dir(new_solution_dir): else: ib_solution_path = get_latest_ibsolution_path(SOURCE_IB_API_TOKEN, SOURCE_FILES_API, SOURCE_COMPILED_SOLUTIONS_PATH) - resp = download_ibsolution(SOURCE_IB_HOST, SOURCE_IB_API_TOKEN, ib_solution_path, True) + resp = download_ibsolution(SOURCE_IB_HOST, SOURCE_IB_API_TOKEN, ib_solution_path, write_to_local=False, unzip_solution=False) target_path = os.path.join(TARGET_IB_PATH, ib_solution_path.split('/')[-1]) upload_file(TARGET_IB_HOST, TARGET_IB_API_TOKEN, target_path, resp.content) @@ -198,7 +202,7 @@ def copy_solution_to_working_dir(new_solution_dir): if args.download_ibsolution or args.local_flow or args.remote_flow: ib_solution_path = get_latest_ibsolution_path(TARGET_IB_API_TOKEN, TARGET_FILES_API, TARGET_IB_PATH) - download_ibsolution(TARGET_IB_HOST, TARGET_IB_API_TOKEN, ib_solution_path) + download_ibsolution(TARGET_IB_HOST, TARGET_IB_API_TOKEN, ib_solution_path, write_to_local=True, unzip_solution=True) if args.set_github_actions_env_var: if args.local: diff --git a/requirements.txt b/requirements.txt index f229360..d44fe44 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ requests +python-dotenv \ No newline at end of file From 16ce699e8d9d92189421e9c69863f968084b78d4 Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Mon, 29 Apr 2024 16:00:31 +0100 Subject: [PATCH 02/14] Save solution name var --- cicd/migration_helpers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 4c4b456..c2b0db9 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -115,11 +115,12 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=True, resp = read_file_through_api(ib_host, api_token, solution_path) if write_to_local: - with open(solution_path.split('/')[-1], 'wb') as fd: + solution_name = solution_path.split('/')[-1] + with open(solution_name, 'wb') as fd: fd.write(resp.content) if unzip_solution: - zip_path = solution_path.split('/')[-1].replace('ibsolution', 'zip') + zip_path = solution_name.replace('ibsolution', 'zip') with open(zip_path, 'wb') as fd: fd.write(resp.content) with zipfile.ZipFile(zip_path, "r") as zip_ref: From 62b539fc2fb556cfb59a6b09e020c111ade62029 Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Wed, 1 May 2024 13:09:16 +0100 Subject: [PATCH 03/14] Update readme, update default params for download ibsolution --- README.md | 4 ++++ cicd/migration_helpers.py | 2 +- cicd/promote_solution.py | 2 +- cicd/solution_migration_udf.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c86d352..7948f90 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ The pipeline sets environment variables from GitHub secrets and variables and ru ## Setup +### Running locally + +If you're not using CI tooling and running the script locally you will need to set the below environment variables. There is an option to store these variables in a `.env` file which will get loaded in using `load_dotenv()` at the beginning of the script + ### Configure Repo 1. Set the following git secrets in Settings > Secrets and Variables > Actions: diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index c2b0db9..37e3318 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -100,7 +100,7 @@ def compile_and_package_ib_solution(ib_host, api_token, solution_directory_path, return compile_resp, solution_resp -def download_ibsolution(ib_host, api_token, solution_path, write_to_local=True, unzip_solution=True): +def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, unzip_solution=False): """ Get the bytes content of an .ibsolution file diff --git a/cicd/promote_solution.py b/cicd/promote_solution.py index b76d324..177e819 100644 --- a/cicd/promote_solution.py +++ b/cicd/promote_solution.py @@ -170,7 +170,7 @@ def copy_solution_to_working_dir(new_solution_dir): else: ib_solution_path = get_latest_ibsolution_path(SOURCE_IB_API_TOKEN, SOURCE_FILES_API, SOURCE_COMPILED_SOLUTIONS_PATH) - resp = download_ibsolution(SOURCE_IB_HOST, SOURCE_IB_API_TOKEN, ib_solution_path, write_to_local=False, unzip_solution=False) + resp = download_ibsolution(SOURCE_IB_HOST, SOURCE_IB_API_TOKEN, ib_solution_path) target_path = os.path.join(TARGET_IB_PATH, ib_solution_path.split('/')[-1]) upload_file(TARGET_IB_HOST, TARGET_IB_API_TOKEN, target_path, resp.content) diff --git a/cicd/solution_migration_udf.py b/cicd/solution_migration_udf.py index 7ece625..053f3f8 100644 --- a/cicd/solution_migration_udf.py +++ b/cicd/solution_migration_udf.py @@ -46,7 +46,7 @@ def migrate_solution(source_ib_host, target_ib_host, source_api_token, target_ap file_path = os.path.join(solution_build_dir_path, f'{package["name"]}-{package["version"]}.ibsolution') # Download ibsolution from dev environment - resp = download_ibsolution(source_ib_host, source_api_token, file_path, False) + resp = download_ibsolution(source_ib_host, source_api_token, file_path) # Upload IB Solution to Prod solution_name = f'{package["name"]}-{package["version"]}.ibsolution' From 828d35c511ee68ab3f98e0e28ca2781eb75a9632 Mon Sep 17 00:00:00 2001 From: hannahflroiter <125589765+hannahflroiter@users.noreply.github.com> Date: Fri, 3 May 2024 13:21:42 +0100 Subject: [PATCH 04/14] Update cicd/migration_helpers.py Co-authored-by: Ben Hope --- cicd/migration_helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 37e3318..60f225b 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -5,6 +5,7 @@ import requests import zipfile +from pathlib import Path from ib_helpers import upload_chunks, read_file_through_api, package_solution, unzip_files, compile_solution, \ copy_file_within_ib, read_file_content_from_ib, get_file_metadata, create_folder_if_it_does_not_exists, \ From ece6599312523d056169187cfb34e67e3b8abb44 Mon Sep 17 00:00:00 2001 From: hannahflroiter <125589765+hannahflroiter@users.noreply.github.com> Date: Fri, 3 May 2024 13:21:49 +0100 Subject: [PATCH 05/14] Update cicd/migration_helpers.py Co-authored-by: Ben Hope --- cicd/migration_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 60f225b..de77fb1 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -116,7 +116,7 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, resp = read_file_through_api(ib_host, api_token, solution_path) if write_to_local: - solution_name = solution_path.split('/')[-1] + solution_name = Path(solution_path).name with open(solution_name, 'wb') as fd: fd.write(resp.content) From 498f166737af82ee09deedcdf7380689c39a70d8 Mon Sep 17 00:00:00 2001 From: hannahflroiter <125589765+hannahflroiter@users.noreply.github.com> Date: Fri, 3 May 2024 13:21:58 +0100 Subject: [PATCH 06/14] Update cicd/migration_helpers.py Co-authored-by: Ben Hope --- cicd/migration_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index de77fb1..a412f05 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -121,7 +121,7 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, fd.write(resp.content) if unzip_solution: - zip_path = solution_name.replace('ibsolution', 'zip') + zip_path = Path(solution_path).with_suffix(".zip").name with open(zip_path, 'wb') as fd: fd.write(resp.content) with zipfile.ZipFile(zip_path, "r") as zip_ref: From a13e2735df9e452273c6af7fdba9cfa967f11cdc Mon Sep 17 00:00:00 2001 From: hannahflroiter <125589765+hannahflroiter@users.noreply.github.com> Date: Fri, 3 May 2024 13:22:26 +0100 Subject: [PATCH 07/14] Update requirements.txt Co-authored-by: Ben Hope --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d44fe44..df7458c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ requests -python-dotenv \ No newline at end of file +python-dotenv From 05e1dc524803d51f4186478067011df3a2828b75 Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Tue, 7 May 2024 13:16:35 +0100 Subject: [PATCH 08/14] Add test for download_ibsolution --- cicd/migration_helpers.py | 6 ++-- tests/__init__.py | 0 tests/fixtures.py | 26 ++++++++++++++ {cicd => tests}/test_ib_helpers.py | 29 ++------------- tests/test_migration_helpers.py | 58 ++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 30 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/fixtures.py rename {cicd => tests}/test_ib_helpers.py (61%) create mode 100644 tests/test_migration_helpers.py diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 37e3318..a807f63 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -4,9 +4,9 @@ import time import requests -import zipfile +from zipfile import ZipFile -from ib_helpers import upload_chunks, read_file_through_api, package_solution, unzip_files, compile_solution, \ +from cicd.ib_helpers import upload_chunks, read_file_through_api, package_solution, unzip_files, compile_solution, \ copy_file_within_ib, read_file_content_from_ib, get_file_metadata, create_folder_if_it_does_not_exists, \ wait_until_job_finishes @@ -123,7 +123,7 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, zip_path = solution_name.replace('ibsolution', 'zip') with open(zip_path, 'wb') as fd: fd.write(resp.content) - with zipfile.ZipFile(zip_path, "r") as zip_ref: + with ZipFile(zip_path, "r") as zip_ref: zip_ref.extractall(zip_path[:-4]) os.remove(zip_path) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures.py b/tests/fixtures.py new file mode 100644 index 0000000..0b19f99 --- /dev/null +++ b/tests/fixtures.py @@ -0,0 +1,26 @@ +import pytest + +_MOCK_IB_HOST_URL = "https://instbase-fake-testing-url.com" +_MOCK_API_TOKEN = "fake-testing-token" +_MOCK_AUTH_HEADERS = {"Authorization": f"Bearer {_MOCK_API_TOKEN}"} + + +@pytest.fixture +def ib_host_url(): + """Fixture for a mock testing IB host URL + + Returns: + str: Mock IB host URL + """ + return _MOCK_IB_HOST_URL + + +@pytest.fixture +def ib_api_token(): + """Fixture for a mock API token + + Returns: + str: Mock API token + """ + + return _MOCK_API_TOKEN diff --git a/cicd/test_ib_helpers.py b/tests/test_ib_helpers.py similarity index 61% rename from cicd/test_ib_helpers.py rename to tests/test_ib_helpers.py index 6548071..08ffff0 100644 --- a/cicd/test_ib_helpers.py +++ b/tests/test_ib_helpers.py @@ -1,33 +1,8 @@ """Collection of unit tests for IB Helpers""" from unittest import mock -import pytest from requests.models import Response -from .ib_helpers import upload_file - -_MOCK_IB_HOST_URL = "https://instbase-fake-testing-url.com" -_MOCK_API_TOKEN = "fake-testing-token" -_MOCK_AUTH_HEADERS = {"Authorization": f"Bearer {_MOCK_API_TOKEN}"} - - -@pytest.fixture -def ib_host_url(): - """Fixture for a mock testing IB host URL - - Returns: - str: Mock IB host URL - """ - return _MOCK_IB_HOST_URL - - -@pytest.fixture -def ib_api_token(): - """Fixture for a mock API token - - Returns: - str: Mock API token - """ - - return _MOCK_API_TOKEN +from cicd.ib_helpers import upload_file +from tests.fixtures import ib_host_url, ib_api_token, _MOCK_IB_HOST_URL, _MOCK_AUTH_HEADERS @mock.patch("cicd.ib_helpers.requests") diff --git a/tests/test_migration_helpers.py b/tests/test_migration_helpers.py new file mode 100644 index 0000000..830ee1b --- /dev/null +++ b/tests/test_migration_helpers.py @@ -0,0 +1,58 @@ +"""Collection of unit tests for IB Helpers""" +from unittest.mock import mock_open, patch, Mock +from requests.models import Response +from cicd.migration_helpers import download_ibsolution +from tests.fixtures import ib_host_url, ib_api_token, _MOCK_IB_HOST_URL, _MOCK_AUTH_HEADERS + + +@patch("cicd.ib_helpers.requests") +def test_download_ibsolution(mock_requests, ib_host_url, ib_api_token): + mocked_response = Mock(spec=Response) + mocked_response.status_code = 200 + mock_requests.get.return_value = mocked_response + solution_path = "Test Space/Test Subspace/fs/Instabase Drive/solution/dummy_solution-0.0.1.ibsolution" + + resp = download_ibsolution( + ib_host_url, ib_api_token, solution_path + ) + + mock_requests.get.assert_called_with( + f"{_MOCK_IB_HOST_URL}/api/v2/files/{solution_path}", + headers=_MOCK_AUTH_HEADERS, + verify=False, + params={'expect-node-type': 'file'} + ) + assert resp.status_code == 200 + + +@patch('cicd.migration_helpers.os.remove') +@patch("cicd.migration_helpers.ZipFile") +@patch('builtins.open', new_callable=mock_open) +@patch("cicd.ib_helpers.requests") +def test_download_ibsolution_and_unzip(mock_requests, mock_open, mock_zip, mock_remove, ib_host_url, ib_api_token): + mocked_response = Mock(spec=Response) + mocked_response.status_code = 200 + mock_requests.get.return_value = mocked_response + solution_path = "Test Space/Test Subspace/fs/Instabase Drive/solution/dummy_solution-0.0.1.ibsolution" + + resp = download_ibsolution( + ib_host_url, ib_api_token, solution_path, True, True + ) + + mock_zip.assert_called_with( + 'dummy_solution-0.0.1.zip', + 'r' + ) + + mock_remove.assert_called_with( + 'dummy_solution-0.0.1.zip' + ) + + mock_requests.get.assert_called_with( + f"{_MOCK_IB_HOST_URL}/api/v2/files/{solution_path}", + headers=_MOCK_AUTH_HEADERS, + verify=False, + params={'expect-node-type': 'file'} + ) + assert resp.status_code == 200 + From 497564c8e14541fe6d7778df61154ccb0781660c Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Tue, 7 May 2024 13:28:55 +0100 Subject: [PATCH 09/14] TEMP testing pipeline --- .github/workflows/run-tests.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 5d21851..fb374ee 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -16,6 +16,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox - - name: Test - run: tox + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Run tests + run: | + python -m pytest tests +# - name: Test +# run: tox From a47d8a037871c8d8afc4babe1452de417198d9df Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Tue, 7 May 2024 13:30:06 +0100 Subject: [PATCH 10/14] TEMP testing pipeline --- .github/workflows/run-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index fb374ee..9cc7f87 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -17,7 +17,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install -r test-requirements.txt + pip install -r requirements-test.txt - name: Run tests run: | python -m pytest tests From 87d9a6681296b22bf63c5609aaf1be5e061f9081 Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Tue, 7 May 2024 14:21:36 +0100 Subject: [PATCH 11/14] Put tox back --- .github/workflows/run-tests.yaml | 10 +++------- tox.ini | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 9cc7f87..5d21851 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -16,10 +16,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-test.txt - - name: Run tests - run: | - python -m pytest tests -# - name: Test -# run: tox + pip install tox + - name: Test + run: tox diff --git a/tox.ini b/tox.ini index b7fc432..fdf13bc 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ description = install pytest in a virtual environment and invoke it on the tests deps = -rrequirements.txt -rrequirements-test.txt -commands = pytest --cov --cov-append cicd {posargs} +commands = pytest --cov --cov-append tests {posargs} [testenv:clean] deps = coverage From a5af5db2f95b1064e926df5b728834983696aadd Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Tue, 7 May 2024 14:36:46 +0100 Subject: [PATCH 12/14] Remove load_dotenv to not clash with Michaek's changes --- cicd/promote_solution.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cicd/promote_solution.py b/cicd/promote_solution.py index 177e819..d860bda 100644 --- a/cicd/promote_solution.py +++ b/cicd/promote_solution.py @@ -15,10 +15,6 @@ from migration_helpers import download_ibsolution, compile_and_package_ib_solution, \ download_dependencies_from_dev_and_upload_to_prod -from dotenv import load_dotenv - -load_dotenv() - TARGET_IB_API_TOKEN = os.environ.get('TARGET_IB_API_TOKEN') SOURCE_IB_API_TOKEN = os.environ.get('SOURCE_IB_API_TOKEN') From 814e5f150c336a6dd583f806c33310726291f458 Mon Sep 17 00:00:00 2001 From: hannahflroiter <125589765+hannahflroiter@users.noreply.github.com> Date: Thu, 9 May 2024 12:42:52 +0100 Subject: [PATCH 13/14] Update cicd/migration_helpers.py Co-authored-by: Ben Hope --- cicd/migration_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index 2aebdcc..d84b432 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -125,7 +125,8 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, with open(zip_path, 'wb') as fd: fd.write(resp.content) with ZipFile(zip_path, "r") as zip_ref: - zip_ref.extractall(zip_path[:-4]) + unzip_dir = Path(zip_path.parent, zip_path.stem) + zip_ref.extractall(unzip_dir) os.remove(zip_path) return resp From 582cbdacc4fd20fd81c2c3bd4c50b3c17c92c7ee Mon Sep 17 00:00:00 2001 From: Hannah Roiter Date: Thu, 9 May 2024 12:49:16 +0100 Subject: [PATCH 14/14] Make zip_path a path --- cicd/migration_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicd/migration_helpers.py b/cicd/migration_helpers.py index d84b432..d396d4e 100644 --- a/cicd/migration_helpers.py +++ b/cicd/migration_helpers.py @@ -125,7 +125,7 @@ def download_ibsolution(ib_host, api_token, solution_path, write_to_local=False, with open(zip_path, 'wb') as fd: fd.write(resp.content) with ZipFile(zip_path, "r") as zip_ref: - unzip_dir = Path(zip_path.parent, zip_path.stem) + unzip_dir = Path(Path(zip_path).parent, Path(zip_path).stem) zip_ref.extractall(unzip_dir) os.remove(zip_path)