Skip to content

Replace print statement with logger #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python-package/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import logging

test_logger = logging.getLogger("test")
test_logger.setLevel(logging.INFO)
11 changes: 6 additions & 5 deletions python-package/tests/azure/create_azure_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
import pathlib

import mc2client as mc2
from . import test_logger as logger

tests_dir = pathlib.Path(__file__).parent.absolute()
config = os.path.join(tests_dir, "../test.yaml")
mc2.set_config(config)

dummy_file = os.path.join(tests_dir, "dummy.txt")

print("Creating resource group")
logger.info("Creating resource group")
mc2.create_resource_group()

print("Creating storage")
logger.info("Creating storage")
mc2.create_storage()

print("Creating container")
logger.info("Creating container")
mc2.create_container()

print("Uploading file")
logger.info("Uploading file")
mc2.upload_file(dummy_file, "dummy.txt")

print("Creating cluster")
logger.info("Creating cluster")
mc2.create_cluster()
16 changes: 9 additions & 7 deletions python-package/tests/azure/delete_azure_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,32 @@
import pathlib

import mc2client as mc2
from . import test_logger as logger

print("Setting config file path")

logger.info("Setting config file path")
tests_dir = pathlib.Path(__file__).parent.absolute()
config = os.path.join(tests_dir, "../test.yaml")
mc2.set_config(config)

download_path = os.path.join(tests_dir, "dummy_downloaded.txt")

print("Downloading file")
logger.info("Downloading file")
mc2.download_file("dummy.txt", download_path)

if not os.path.isfile(download_path):
print("Error: Couldn't download file from Azure")
logger.info("Error: Couldn't download file from Azure")
else:
os.remove(download_path)

print("Deleting container")
logger.info("Deleting container")
mc2.delete_container()

print("Deleting storage")
logger.info("Deleting storage")
mc2.delete_storage()

print("Deleting cluster")
logger.info("Deleting cluster")
mc2.delete_cluster()

print("Deleting resource group")
logger.info("Deleting resource group")
mc2.delete_resource_group()