From b0c753a0329936eaf240007de1127505077bf6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99?= Date: Tue, 8 Oct 2024 17:40:34 +0200 Subject: [PATCH] Hopefully pipeline passes --- poetry.lock | 16 +++++++++++++++- pyproject.toml | 1 + tests/.env | 3 +++ tests/test_model_download.py | 11 +++-------- 4 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 tests/.env diff --git a/poetry.lock b/poetry.lock index a43b7a5..d068bda 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1465,6 +1465,20 @@ files = [ [package.dependencies] six = ">=1.5" +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "pyyaml" version = "6.0.2" @@ -1913,4 +1927,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "ce109977e1cb0353d5884723b201c7afd36cffd5ba5fc92618274c805b3bced7" +content-hash = "f268faf0d77d8e6a7e9e19b2c69658a3ec3af43d418d4a1c7ba30e97cd92d8a3" diff --git a/pyproject.toml b/pyproject.toml index 67ed312..0c69582 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ boto3 = "^1.35.10" fastapi = "^0.115.0" uvicorn = "^0.30.6" tomli = "^2.0.1" +python-dotenv = "^1.0.1" [tool.poetry.group.dev.dependencies] moto = "^5.0.13" diff --git a/tests/.env b/tests/.env new file mode 100644 index 0000000..0079ddc --- /dev/null +++ b/tests/.env @@ -0,0 +1,3 @@ +DATA_BASE_DIR=data +MODEL_BASE_DIR=model +S3_ENDPOINT_URL=https://someurl.org \ No newline at end of file diff --git a/tests/test_model_download.py b/tests/test_model_download.py index 716a9a5..84455a3 100644 --- a/tests/test_model_download.py +++ b/tests/test_model_download.py @@ -1,19 +1,14 @@ import pytest import shutil import os -import logging +from dotenv import load_dotenv -# Mocking environment used in model_download -os.environ["DATA_BASE_DIR"] = "data" -os.environ["MODEL_BASE_DIR"] = "model" -os.environ["S3_ENDPOINT_URL"] = "https://someurl.org" +# Mocking environment used in model_download (by loading tests/.env) +load_dotenv() from model_download import extract_model, get_model_location # noqa -logger = logger = logging.getLogger(__name__) - - @pytest.mark.parametrize( "destination, extension, expected_output", [