From 7f055dbe8f06c1d28e814d49163aead0d616827f Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 12:12:20 +0100 Subject: [PATCH 01/19] test.unit.test_utils: Remove unused method 'from_env' --- tests/unit/test_utils.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index dea1160c..44e244b4 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -24,15 +24,6 @@ from odes_storage.models import Record, StorageAcl, Legal from app.model.model_utils import record_to_dict from app.utils import get_or_create_ctx - -def from_env(key, default=None): - import os - result = os.environ.get(key, default) - # assert result, "Failed to get {} env variable".format(key) - return result - - - @pytest.fixture() def ctx_fixture(): """ Create context with a fake tracer in it """ -- GitLab From 45bdfc6ffb5b8bf3854d7a32dd7ebc147bafb607 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 12:14:38 +0100 Subject: [PATCH 02/19] tests.unit: remove unused 'monkeypatch' fixture argument --- tests/unit/app_conf_test.py | 4 ++-- tests/unit/routers/about_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/app_conf_test.py b/tests/unit/app_conf_test.py index 91343e4f..bbe205eb 100644 --- a/tests/unit/app_conf_test.py +++ b/tests/unit/app_conf_test.py @@ -38,7 +38,7 @@ def testing_config(): @pytest.fixture() -def gcp_config_fixture(monkeypatch): +def gcp_config_fixture(): provider_name = "gcp" environment_dict = os.environ.copy() @@ -57,7 +57,7 @@ def gcp_config_fixture(monkeypatch): @pytest.fixture() -def azure_config_fixture(monkeypatch): +def azure_config_fixture(): provider_name = "az" environment_dict = os.environ.copy() diff --git a/tests/unit/routers/about_test.py b/tests/unit/routers/about_test.py index 1d64e83e..980bce42 100644 --- a/tests/unit/routers/about_test.py +++ b/tests/unit/routers/about_test.py @@ -77,7 +77,7 @@ def test_version_requires_authentication(client, path_prefix): @pytest.mark.parametrize("path_prefix", PathPrefixParams) -def test_version_properly_read_details(client_with_authenticated_user, monkeypatch, path_prefix): +def test_version_properly_read_details(client_with_authenticated_user, path_prefix): # override value of build details Config.build_details.value = 'key1=value1; key2=value2' -- GitLab From 83e7a11aa8b107c3110e12826c297f32e68edf3b Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 13:10:41 +0100 Subject: [PATCH 03/19] tests.unit: Remove unused function 'patch_async()' --- NOTICE | 1 - requirements.txt | 15 +-------------- requirements_dev.in | 1 - requirements_dev.txt | 23 +---------------------- tests/unit/errors/error_handler_test.py | 2 +- tests/unit/routers/dipset/dip_ddms_v2.py | 2 +- tests/unit/test_utils.py | 6 ------ 7 files changed, 4 insertions(+), 46 deletions(-) diff --git a/NOTICE b/NOTICE index b9d5bad8..0b8451f1 100644 --- a/NOTICE +++ b/NOTICE @@ -275,7 +275,6 @@ The following software have components provided under the terms of this license: - pytest (from http://pytest.org) - pytest-cov (from https://github.com/pytest-dev/pytest-cov) - pytest-httpx (from https://colin-b.github.io/pytest_httpx/) -- pytest-mock (from https://github.com/pytest-dev/pytest-mock/) - python-rapidjson (from https://github.com/python-rapidjson/python-rapidjson) - python-ulid (from https://github.com/mdomke/python-ulid) - pytz (from http://pythonhosted.org/pytz) diff --git a/requirements.txt b/requirements.txt index 629b0ef9..bb7b9f00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.7 +# This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile requirements.in @@ -192,10 +192,6 @@ idna==3.2 # requests # rfc3986 # yarl -importlib-metadata==4.8.1 - # via - # click - # jsonschema isodate==0.6.0 # via msrest jinja2==3.0.3 @@ -405,16 +401,9 @@ tornado==6.1 typing-extensions==3.10.0.0 # via # aiohttp - # aioitertools - # anyio - # asgiref - # importlib-metadata # osdu-data-ecosystem-search # osdu-data-ecosystem-storage # pydantic - # structlog - # uvicorn - # yarl urllib3==1.26.6 # via # botocore @@ -429,8 +418,6 @@ yarl==1.6.3 # via aiohttp zict==2.0.0 # via distributed -zipp==3.6.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements_dev.in b/requirements_dev.in index 795d9f52..89146924 100644 --- a/requirements_dev.in +++ b/requirements_dev.in @@ -5,7 +5,6 @@ pip-tools>=6.4.0 pytest pytest-asyncio pytest-cov -pytest-mock pytest-httpx httpx numpy diff --git a/requirements_dev.txt b/requirements_dev.txt index 8046fa5e..69471d4d 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.7 +# This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile requirements_dev.in @@ -61,14 +61,6 @@ idna==3.2 # anyio # requests # rfc3986 -importlib-metadata==4.8.1 - # via - # -c requirements.txt - # click - # jsonschema - # pep517 - # pluggy - # pytest iniconfig==1.1.1 # via pytest isodate==0.6.0 @@ -142,7 +134,6 @@ pytest==6.2.4 # pytest-cov # pytest-dependency # pytest-httpx - # pytest-mock pytest-asyncio==0.15.1 # via -r requirements_dev.in pytest-cov==2.12.1 @@ -151,8 +142,6 @@ pytest-dependency==0.5.1 # via -r requirements_dev.in pytest-httpx==0.12.0 # via -r requirements_dev.in -pytest-mock==3.6.1 - # via -r requirements_dev.in python-dateutil==2.8.2 # via # -c requirements.txt @@ -194,22 +183,12 @@ toml==0.10.2 # pytest-cov tomli==1.2.0 # via pep517 -typing-extensions==3.10.0.0 - # via - # -c requirements.txt - # anyio - # importlib-metadata urllib3==1.26.6 # via # -c requirements.txt # requests wheel==0.36.2 # via pip-tools -zipp==3.6.0 - # via - # -c requirements.txt - # importlib-metadata - # pep517 # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/tests/unit/errors/error_handler_test.py b/tests/unit/errors/error_handler_test.py index 25350bc0..344b1727 100644 --- a/tests/unit/errors/error_handler_test.py +++ b/tests/unit/errors/error_handler_test.py @@ -29,7 +29,7 @@ from app.clients import * from app.helper import traces, logger from app.auth.auth import require_opendes_authorized_user -from tests.unit.test_utils import patch_async, create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class, nope_logger_fixture from odes_storage.exceptions import ( UnexpectedResponse as OSDUStorageUnexpectedResponse, ResponseValidationError as OSDUStorageResponseValidationError, diff --git a/tests/unit/routers/dipset/dip_ddms_v2.py b/tests/unit/routers/dipset/dip_ddms_v2.py index 7d5563e2..799a60f0 100644 --- a/tests/unit/routers/dipset/dip_ddms_v2.py +++ b/tests/unit/routers/dipset/dip_ddms_v2.py @@ -15,7 +15,7 @@ from app.clients import * from app.auth.auth import require_opendes_authorized_user from tests.unit.errors.error_handler_test import StorageRecordServiceBlobStorageMock -from tests.unit.test_utils import patch_async, create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class, nope_logger_fixture from odes_storage.exceptions import UnexpectedResponse import pandas as pd diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 44e244b4..ddf4ac97 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -95,12 +95,6 @@ class AsyncMock: return args[self._from_input_index] -def patch_async(target: str, return_value, mocker=mock): - future = asyncio.Future() - future.set_result(return_value) - return mocker.patch(target, return_value=future) - - def create_mock_class(cls_to_mock): cls_name = cls_to_mock.__name__ + 'AutoMock' -- GitLab From 3781b3b99ae8157a2d056699cdd73c338403636e Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 14:13:44 +0100 Subject: [PATCH 04/19] tests.unit.test_utils: Remove unused class 'AsyncMock --- tests/unit/test_utils.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index ddf4ac97..53a41783 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -75,26 +75,6 @@ class NopeLogger: # empty method pass - -class AsyncMock: - def __init__(self, *, return_value=None, forward_input_name: str = None, forward_input_index: int = 0): - self._return_value = return_value - self._from_input = forward_input_name - self._from_input_index = forward_input_index - - async def __call__(self, *args, **kwargs): - if self._return_value is not None: - return self._return_value - - if self._from_input: - return kwargs[self._from_input] - - if self._from_input_index < 0: - return None - - return args[self._from_input_index] - - def create_mock_class(cls_to_mock): cls_name = cls_to_mock.__name__ + 'AutoMock' -- GitLab From 8a2553058432eee0382fbda3e40e51059b069a3b Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 14:14:36 +0100 Subject: [PATCH 05/19] tests.unit.test_utils: remove unused function 'assert_dict_contained' --- tests/unit/routers/ddms_v2/log_ddms_v2_test.py | 2 +- tests/unit/test_utils.py | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/tests/unit/routers/ddms_v2/log_ddms_v2_test.py b/tests/unit/routers/ddms_v2/log_ddms_v2_test.py index dc908c29..eb9e9538 100644 --- a/tests/unit/routers/ddms_v2/log_ddms_v2_test.py +++ b/tests/unit/routers/ddms_v2/log_ddms_v2_test.py @@ -42,7 +42,7 @@ from app.bulk_persistence import MimeTypes from app.utils import Context from app.wdms_app import wdms_app, app_injector from app.clients import * -from tests.unit.test_utils import assert_dict_contained, make_record, nope_logger_fixture +from tests.unit.test_utils import make_record, nope_logger_fixture # Initialize traces exporter in app, like it is in app's startup decorator wdms_app.trace_exporter = traces.CombinedExporter(service_name='tested-ddms') diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 53a41783..6c0554cb 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -149,22 +149,6 @@ def create_mock_class(cls_to_mock): return _new_class_ -def assert_dict_contained(dict_to_check: dict, ref_dict: dict, path=''): - """ - check actual dict contained ref_dict - path param use the default value - """ - for key, value in ref_dict.items(): - current_path = path + '.' + key if path else key - assert key in dict_to_check - sub_item = dict_to_check[key] - assert type(sub_item) == type(value), f'type of {current_path} ({type(sub_item)}) != ref {type(value)}' - if type(value) == dict: - assert_dict_contained(sub_item, value, current_path) - else: - assert sub_item == value, f'{current_path}: actual {sub_item} != ref {value}' - - @pytest.fixture async def temp_directory() -> str: with TemporaryDirectory() as tmpdir: -- GitLab From c8c9db3060b56c44bcf09bd256260da5fe45623e Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 14:16:11 +0100 Subject: [PATCH 06/19] tests.unit.test_utils: remove unused function make_fn_return_value, make_fn_do_nothing, make_async_return_value, make_async_do_nothing --- tests/unit/test_utils.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 6c0554cb..df57c380 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -171,29 +171,6 @@ def basic_record(kind: str = None): return make_record() if kind is None else make_record(kind=kind) -def make_fn_return_value(value_to_return, as_coroutine: bool = False): - if not as_coroutine: - return lambda *args, **kwargs: value_to_return - - async def return_async_fn(*args, **kwargs): - return value_to_return - - return return_async_fn - - -def make_fn_do_nothing(as_coroutine: bool = False): - return make_fn_return_value(None, as_coroutine) - - -def make_async_return_value(value_to_return): - return make_fn_return_value(value_to_return, True) - - -def make_async_do_nothing(): - return make_fn_do_nothing(True) - - - # Format selected routes for spec generation def format_routes(app, prefix, tags): for route in app.routes: -- GitLab From 4523093d1b130f18b4b6a2aeb8a6c0f6aa532fec Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 15:00:18 +0100 Subject: [PATCH 07/19] tests.unit Replace homemade 'temp_directory' fixture with pytest.tmp_path fixture --- .../dataframe_serializer_test.py | 44 ++++++++------- tests/unit/conftest.py | 10 ++-- .../persistence/dask_blob_storage_test.py | 8 ++- .../unit/persistence/sessions_storage_test.py | 6 +-- tests/unit/routers/chunking_test.py | 51 +++++++++--------- tests/unit/routers/ddms_v2/log_data_test.py | 36 ++++++------- .../unit/routers/ddms_v2/log_ddms_v2_test.py | 35 ++++++------ .../routers/ddms_v3/common_ddms_v3_test.py | 54 +++++++++---------- .../trajectory/trajectory_ddms_v2_test.py | 36 ++++++------- tests/unit/test_utils.py | 8 +-- 10 files changed, 134 insertions(+), 154 deletions(-) diff --git a/tests/unit/bulk_persistence/dataframe_serializer_test.py b/tests/unit/bulk_persistence/dataframe_serializer_test.py index 13374ba9..f21c4a55 100644 --- a/tests/unit/bulk_persistence/dataframe_serializer_test.py +++ b/tests/unit/bulk_persistence/dataframe_serializer_test.py @@ -15,7 +15,6 @@ from app.bulk_persistence.dataframe_serializer import (DataframeSerializerSync, DataframeSerializerAsync, JSONOrient) -from tests.unit.test_utils import temp_directory import pandas as pd import json import pytest @@ -25,7 +24,12 @@ from unittest.mock import patch from tempfile import SpooledTemporaryFile Reference_df = pd.DataFrame([[1., 10, 11], [2., 20, 21], [3., 30, 31]], columns=['ref', 'a', 'b']) -CONSTANT_DATA_JSON = '/data.json' + + +@pytest.fixture() +def data_path(tmp_path): + yield tmp_path / 'data.json' + # we're building it manually as we want to spot any change from anywhere that could occur (in pandas for instance) # we want format to be stable @@ -66,31 +70,31 @@ def test_load_from_str_various_orient(data_dict, orient): check_dataframe(df) -def test_load_from_path(temp_directory): +def test_load_from_path(data_path): orient = 'split' data_dict = dataframe_dict[orient] - path = temp_directory + CONSTANT_DATA_JSON - with open(path, 'w') as file: + + with open(data_path, 'w') as file: json.dump(data_dict, file) - df = DataframeSerializerSync.read_json(path, orient=orient) + df = DataframeSerializerSync.read_json(data_path, orient=orient) check_dataframe(df) -def test_load_from_file_like(temp_directory): +def test_load_from_file_like(data_path): orient = 'split' data_dict = dataframe_dict[orient] - path = temp_directory + CONSTANT_DATA_JSON - with open(path, 'w') as file: + + with open(data_path, 'w') as file: json.dump(data_dict, file) - with open(path, 'r') as file: + with open(data_path, 'r') as file: df = DataframeSerializerSync.read_json(file, orient=orient) check_dataframe(df) -def test_load_parquet_from_file_like(temp_directory): - path = temp_directory + '/data.parquet' +def test_load_parquet_from_file_like(tmp_path): + path = tmp_path / 'data.parquet' Reference_df.to_parquet(path) with open(path, 'rb') as file: @@ -144,29 +148,29 @@ async def test_back_forth_async_serializer(): check_dataframe(df) -def test_to_json_to_path(temp_directory): +def test_to_json_to_path(data_path): orient = 'split' data_dict = dataframe_dict[orient] - path = temp_directory + CONSTANT_DATA_JSON - result = DataframeSerializerSync.to_json(Reference_df, path_or_buf=path, orient=orient) + + result = DataframeSerializerSync.to_json(Reference_df, path_or_buf=data_path, orient=orient) assert result is None - with open(path, 'r') as file: + with open(data_path, 'r') as file: actual_dict = json.load(file) assert actual_dict == data_dict -def test_to_json_to_file(temp_directory): +def test_to_json_to_file(data_path): orient = 'split' data_dict = dataframe_dict[orient] - path = temp_directory + CONSTANT_DATA_JSON - with open(path, 'w') as file: + + with open(data_path, 'w') as file: result = DataframeSerializerSync.to_json(Reference_df, path_or_buf=file, orient=orient) assert result is None - with open(path, 'r') as file: + with open(data_path, 'r') as file: actual_dict = json.load(file) assert actual_dict == data_dict diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index a118d475..a0042ad1 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -14,7 +14,6 @@ import asyncio import os -from tempfile import TemporaryDirectory import app.conf as conf import pytest @@ -68,11 +67,10 @@ def event_loop(): # all tests will share the same loop @pytest.fixture -def init_fixtures(nope_logger_fixture, monkeypatch): - with TemporaryDirectory() as tmp_dir: - monkeypatch.setenv(name="USE_LOCALFS_BLOB_STORAGE_WITH_PATH", value=tmp_dir) - conf.Config = conf.ConfigurationContainer.with_load_all() - yield +def init_fixtures(nope_logger_fixture, monkeypatch, tmp_path): + monkeypatch.setenv(name="USE_LOCALFS_BLOB_STORAGE_WITH_PATH", value=tmp_path) + conf.Config = conf.ConfigurationContainer.with_load_all() + yield async def do_nothing(): diff --git a/tests/unit/persistence/dask_blob_storage_test.py b/tests/unit/persistence/dask_blob_storage_test.py index b99fa666..b408b592 100644 --- a/tests/unit/persistence/dask_blob_storage_test.py +++ b/tests/unit/persistence/dask_blob_storage_test.py @@ -13,7 +13,6 @@ # limitations under the License. import asyncio from datetime import datetime, timedelta -from tempfile import TemporaryDirectory import dask.dataframe as dd import numpy as np import pandas as pd @@ -39,10 +38,9 @@ from app.bulk_persistence.dataframe_validators import no_validation @pytest.fixture() -async def dask_storage(nope_logger_fixture, ctx_fixture) -> DaskBulkStorage: - with TemporaryDirectory() as tmp_dir: - dask_storage = await make_local_dask_bulk_storage(base_directory=tmp_dir) - yield dask_storage +async def dask_storage(nope_logger_fixture, ctx_fixture, tmp_path) -> DaskBulkStorage: + dask_storage = await make_local_dask_bulk_storage(base_directory=tmp_path) + yield dask_storage @pytest.fixture() diff --git a/tests/unit/persistence/sessions_storage_test.py b/tests/unit/persistence/sessions_storage_test.py index ab7272cc..042471e4 100644 --- a/tests/unit/persistence/sessions_storage_test.py +++ b/tests/unit/persistence/sessions_storage_test.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from tempfile import TemporaryDirectory from datetime import datetime, timedelta import pytest @@ -36,10 +35,9 @@ from unittest.mock import patch, PropertyMock @pytest.fixture -def sessions_storage(): +def sessions_storage(tmp_path): Context(logger=NopeLogger).set_current() - with TemporaryDirectory() as tmp_dir: - yield SessionsStorage(LocalFSBlobStorage(directory=tmp_dir)) + yield SessionsStorage(LocalFSBlobStorage(directory=tmp_path)) @pytest.fixture diff --git a/tests/unit/routers/chunking_test.py b/tests/unit/routers/chunking_test.py index 46ef930d..68fec59f 100644 --- a/tests/unit/routers/chunking_test.py +++ b/tests/unit/routers/chunking_test.py @@ -1,6 +1,6 @@ import io import math -from tempfile import TemporaryDirectory +import platform import numpy as np import pandas as pd @@ -122,36 +122,36 @@ def _cast_datetime_to_datetime64_ns(result_df): @pytest.fixture -def dasked_test_app(init_fixtures, event_loop): - with TemporaryDirectory() as tmp_dir: - local_blob_storage = LocalFSBlobStorage(directory=tmp_dir) +def dasked_test_app(init_fixtures, event_loop, tmp_path): - async def storage_service_builder(*args, **kwargs): - return StorageRecordServiceBlobStorage(local_blob_storage, 'myProject', 'myContainer') + local_blob_storage = LocalFSBlobStorage(directory=tmp_path) - async def blob_storage_builder(*args, **kwargs): - return local_blob_storage + async def storage_service_builder(*args, **kwargs): + return StorageRecordServiceBlobStorage(local_blob_storage, 'myProject', 'myContainer') - async def sessions_storage_builder(*args, **kwargs): - return SessionsStorage(local_blob_storage) + async def blob_storage_builder(*args, **kwargs): + return local_blob_storage - async def dask_blob_storage_builder() -> DaskBulkStorage: - return await make_local_dask_bulk_storage(base_directory=tmp_dir) + async def sessions_storage_builder(*args, **kwargs): + return SessionsStorage(local_blob_storage) - app_injector.register(DaskBulkStorage, dask_blob_storage_builder) - app_injector.register(BlobStorageBase, blob_storage_builder) - app_injector.register(SessionsStorage, sessions_storage_builder) - app_injector.register(StorageRecordServiceClient, storage_service_builder) + async def dask_blob_storage_builder() -> DaskBulkStorage: + return await make_local_dask_bulk_storage(base_directory=tmp_path) - wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing - wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition + app_injector.register(DaskBulkStorage, dask_blob_storage_builder) + app_injector.register(BlobStorageBase, blob_storage_builder) + app_injector.register(SessionsStorage, sessions_storage_builder) + app_injector.register(StorageRecordServiceClient, storage_service_builder) - # Initialize traces exporter in app, like it is in app's startup decorator - wdms_app.trace_exporter = traces.CombinedExporter(service_name='tested-ddms') + wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing + wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition - yield wdms_app - # clean up - wdms_app.dependency_overrides = {} + # Initialize traces exporter in app, like it is in app's startup decorator + wdms_app.trace_exporter = traces.CombinedExporter(service_name='tested-ddms') + + yield wdms_app + # clean up + wdms_app.dependency_overrides = {} @pytest.fixture @@ -935,10 +935,7 @@ def test_send_json_parquet_in_one_session(dasked_test_app_without_consistency_cl commit_session_response = client.patch(f'{chunking_url}/{record_id}/sessions/{session_id}', json={'state': 'commit'}) - assert commit_session_response.status_code == 200 - - get_response = client.get(f'{chunking_url}/{record_id}/data') - assert get_response.status_code == 200 + assert_commit_session_status_code(commit_session_response) @pytest.mark.parametrize("entity_type", EntityTypeParams) diff --git a/tests/unit/routers/ddms_v2/log_data_test.py b/tests/unit/routers/ddms_v2/log_data_test.py index 6f44a654..8c4c9a00 100644 --- a/tests/unit/routers/ddms_v2/log_data_test.py +++ b/tests/unit/routers/ddms_v2/log_data_test.py @@ -16,8 +16,6 @@ import os from tests.unit.test_utils import create_mock_class, nope_logger_fixture -from tempfile import TemporaryDirectory - from fastapi import HTTPException, Header from fastapi.testclient import TestClient import pytest @@ -72,30 +70,30 @@ StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) @pytest.fixture -def client(nope_logger_fixture): - with TemporaryDirectory() as tmpdir: - async def storage_service_builder(*args, **kwargs): - return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmpdir), 'p1', 'c1') +def client(nope_logger_fixture, tmp_path): + + async def storage_service_builder(*args, **kwargs): + return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmp_path), 'p1', 'c1') - async def blob_storage_builder(*args, **kwargs): - return LocalFSBlobStorage(directory=tmpdir) + async def blob_storage_builder(*args, **kwargs): + return LocalFSBlobStorage(directory=tmp_path) - async def set_default_partition(data_partition_id: str = Header('opendes')): - Context.set_current_with_value(partition_id=data_partition_id) + async def set_default_partition(data_partition_id: str = Header('opendes')): + Context.set_current_with_value(partition_id=data_partition_id) - app_injector.register(BlobStorageBase, blob_storage_builder) - app_injector.register(StorageRecordServiceClient, storage_service_builder) + app_injector.register(BlobStorageBase, blob_storage_builder) + app_injector.register(StorageRecordServiceClient, storage_service_builder) - async def do_nothing(): - # empty method - pass + async def do_nothing(): + # empty method + pass - wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing - wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition + wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing + wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition - yield TestClient(wdms_app) + yield TestClient(wdms_app) - wdms_app.dependency_overrides = {} # clean up + wdms_app.dependency_overrides = {} # clean up @pytest.fixture diff --git a/tests/unit/routers/ddms_v2/log_ddms_v2_test.py b/tests/unit/routers/ddms_v2/log_ddms_v2_test.py index eb9e9538..8665706a 100644 --- a/tests/unit/routers/ddms_v2/log_ddms_v2_test.py +++ b/tests/unit/routers/ddms_v2/log_ddms_v2_test.py @@ -18,7 +18,7 @@ tests specific to logset APIs. Common tests implemented in common_ddms_v2_test import asyncio import json -from tempfile import TemporaryDirectory + from io import BytesIO import numpy as np @@ -100,30 +100,29 @@ class TestHelper: @pytest.fixture -def client(nope_logger_fixture): - with TemporaryDirectory() as tmpdir: - async def storage_service_builder(*args, **kwargs): - return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmpdir), 'p1', 'c1') +def client(nope_logger_fixture, tmp_path): + async def storage_service_builder(*args, **kwargs): + return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmp_path), 'p1', 'c1') - async def blob_storage_builder(*args, **kwargs): - return LocalFSBlobStorage(directory=tmpdir) + async def blob_storage_builder(*args, **kwargs): + return LocalFSBlobStorage(directory=tmp_path) - async def set_default_partition(data_partition_id: str = Header('opendes')): - Context.set_current_with_value(partition_id=data_partition_id) + async def set_default_partition(data_partition_id: str = Header('opendes')): + Context.set_current_with_value(partition_id=data_partition_id) - app_injector.register(BlobStorageBase, blob_storage_builder) - app_injector.register(StorageRecordServiceClient, storage_service_builder) + app_injector.register(BlobStorageBase, blob_storage_builder) + app_injector.register(StorageRecordServiceClient, storage_service_builder) - async def do_nothing(): - # empty method - pass + async def do_nothing(): + # empty method + pass - wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing - wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition + wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing + wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition - yield TestClient(wdms_app) + yield TestClient(wdms_app) - wdms_app.dependency_overrides = {} # clean up + wdms_app.dependency_overrides = {} # clean up log_data = [ diff --git a/tests/unit/routers/ddms_v3/common_ddms_v3_test.py b/tests/unit/routers/ddms_v3/common_ddms_v3_test.py index cb5947c2..00093d17 100644 --- a/tests/unit/routers/ddms_v3/common_ddms_v3_test.py +++ b/tests/unit/routers/ddms_v3/common_ddms_v3_test.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from tempfile import TemporaryDirectory import json import os import mock @@ -75,42 +74,41 @@ SearchServiceClientMock = create_mock_class(SearchServiceClient) @pytest.fixture -def dasked_test_app_with_mocked_core_service(nope_logger_fixture, event_loop): +def dasked_test_app_with_mocked_core_service(nope_logger_fixture, event_loop, tmp_path): - with TemporaryDirectory() as tmp_dir: - local_blob_storage = LocalFSBlobStorage(directory=tmp_dir) + local_blob_storage = LocalFSBlobStorage(directory=tmp_path) - async def build_mock_storage(): - return StorageRecordServiceClientMock() + async def build_mock_storage(): + return StorageRecordServiceClientMock() - async def build_mock_search(): - return SearchServiceClientMock() + async def build_mock_search(): + return SearchServiceClientMock() - async def blob_storage_builder(*args, **kwargs): - return local_blob_storage + async def blob_storage_builder(*args, **kwargs): + return local_blob_storage - async def sessions_storage_builder(*args, **kwargs): - return SessionsStorage(local_blob_storage) + async def sessions_storage_builder(*args, **kwargs): + return SessionsStorage(local_blob_storage) - async def dask_blob_storage_builder() -> DaskBulkStorage: - return await make_local_dask_bulk_storage(base_directory=tmp_dir) + async def dask_blob_storage_builder() -> DaskBulkStorage: + return await make_local_dask_bulk_storage(base_directory=tmp_path) - app_injector.register(DaskBulkStorage, dask_blob_storage_builder) - app_injector.register(BlobStorageBase, blob_storage_builder) - app_injector.register(SessionsStorage, sessions_storage_builder) - app_injector.register(StorageRecordServiceClient, build_mock_storage) - app_injector.register(SearchServiceClient, build_mock_search) + app_injector.register(DaskBulkStorage, dask_blob_storage_builder) + app_injector.register(BlobStorageBase, blob_storage_builder) + app_injector.register(SessionsStorage, sessions_storage_builder) + app_injector.register(StorageRecordServiceClient, build_mock_storage) + app_injector.register(SearchServiceClient, build_mock_search) - # override authentication dependency - previous_overrides = wdms_app.dependency_overrides + # override authentication dependency + previous_overrides = wdms_app.dependency_overrides - try: - wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing - wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition - client = TestClient(wdms_app) - yield client - finally: - wdms_app.dependency_overrides = previous_overrides # clean up + try: + wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing + wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition + client = TestClient(wdms_app) + yield client + finally: + wdms_app.dependency_overrides = previous_overrides # clean up # Initialize traces exporter in app, like it is in app's startup decorator diff --git a/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py b/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py index 8be11e8e..9db9d06e 100644 --- a/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py +++ b/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - -from tempfile import TemporaryDirectory - from fastapi.testclient import TestClient from fastapi import Header, status @@ -79,30 +76,29 @@ prev_data = {"columns": ["col_100X"], "data": [[0], [1], [2]], 'index': [0, 1, 2 @pytest.fixture -def client(nope_logger_fixture): - with TemporaryDirectory() as tmpdir: - async def storage_service_builder(*args, **kwargs): - return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmpdir), 'p1', 'c1') +def client(nope_logger_fixture, tmp_path): + async def storage_service_builder(*args, **kwargs): + return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmp_path), 'p1', 'c1') - async def blob_storage_builder(*args, **kwargs): - return LocalFSBlobStorage(directory=tmpdir) + async def blob_storage_builder(*args, **kwargs): + return LocalFSBlobStorage(directory=tmp_path) - async def set_default_partition(data_partition_id: str = Header('opendes')): - Context.set_current_with_value(partition_id=data_partition_id) + async def set_default_partition(data_partition_id: str = Header('opendes')): + Context.set_current_with_value(partition_id=data_partition_id) - app_injector.register(BlobStorageBase, blob_storage_builder) - app_injector.register(StorageRecordServiceClient, storage_service_builder) + app_injector.register(BlobStorageBase, blob_storage_builder) + app_injector.register(StorageRecordServiceClient, storage_service_builder) - async def do_nothing(): - # empty method - pass + async def do_nothing(): + # empty method + pass - wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing - wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition + wdms_app.dependency_overrides[require_opendes_authorized_user] = do_nothing + wdms_app.dependency_overrides[require_data_partition_id] = set_default_partition - yield TestClient(wdms_app) + yield TestClient(wdms_app) - wdms_app.dependency_overrides = {} # clean up + wdms_app.dependency_overrides = {} # clean up @pytest.fixture def client_with_log(client): diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index df57c380..2ebe412d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -15,7 +15,7 @@ import pytest import mock import asyncio -from tempfile import TemporaryDirectory + from opencensus.trace.span_context import SpanContext from contextlib import contextmanager @@ -149,12 +149,6 @@ def create_mock_class(cls_to_mock): return _new_class_ -@pytest.fixture -async def temp_directory() -> str: - with TemporaryDirectory() as tmpdir: - yield tmpdir - - def make_record(as_dict=False, **kwargs): kwargs.setdefault('kind', 'opendes:osdu:raw:2.0.0') kwargs.setdefault('acl', StorageAcl( -- GitLab From 9943821d9094d2a1eb920dba58e124e16d2d0801 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 15:11:54 +0100 Subject: [PATCH 08/19] tests.unit.app_conf_test: Replace 'testing_context' with 'ctx_fixture' in test 'app_conf_test' --- tests/unit/app_conf_test.py | 10 +--------- tests/unit/routers/delete_recursive_test.py | 22 ++++++++++----------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/tests/unit/app_conf_test.py b/tests/unit/app_conf_test.py index bbe205eb..f6325a2b 100644 --- a/tests/unit/app_conf_test.py +++ b/tests/unit/app_conf_test.py @@ -17,21 +17,13 @@ import os import uuid import mock from app.utils import Context -from tests.unit.test_utils import NopeLogger + import app.conf as conf from app.helper.traces import create_exporter from app.conf import ConfigurationContainer, Config, check_environment, validator_path_must_exist, \ cloud_provider_additional_environment -@pytest.fixture -def testing_context(): - """ This is a basic Context initialized with empty logger to ensure tested methods can contains logging calls """ - ctx = Context(logger=NopeLogger(), request_id='this is a test') - Context.set_current(ctx) - return ctx - - @pytest.fixture def testing_config(): return Config diff --git a/tests/unit/routers/delete_recursive_test.py b/tests/unit/routers/delete_recursive_test.py index 4252d32b..424b042c 100644 --- a/tests/unit/routers/delete_recursive_test.py +++ b/tests/unit/routers/delete_recursive_test.py @@ -25,7 +25,7 @@ from app.routers.ddms_v2.storage_helper import StorageHelper from app.model.entity_utils import Entity, get_kind, format_kind from app.utils import Context from tests.unit.test_utils import create_mock_class, make_record -from tests.unit.app_conf_test import testing_context +from tests.unit.test_utils import ctx_fixture StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) @@ -63,7 +63,7 @@ def with_patched_get_record(well_record): @pytest.mark.asyncio -async def test_delete_recursive_only_delete_entity_provided(testing_context, +async def test_delete_recursive_only_delete_entity_provided(ctx_fixture, authority, data_partition, entity_source, @@ -96,7 +96,7 @@ async def test_delete_recursive_only_delete_entity_provided(testing_context, wraps=StorageRecordServiceClientMock.delete_record) as moc_storage_delete_record: # when await StorageHelper.delete_recursively( - testing_context, + ctx_fixture, well_record.id, 'well', [Entity.LOGSET, Entity.MARKER], data_partition, @@ -110,7 +110,7 @@ async def test_delete_recursive_only_delete_entity_provided(testing_context, @pytest.mark.asyncio -async def test_delete_failure_on_parent_dont_delete_children(testing_context, +async def test_delete_failure_on_parent_dont_delete_children(ctx_fixture, authority, data_partition, entity_source, @@ -135,7 +135,7 @@ async def test_delete_failure_on_parent_dont_delete_children(testing_context, side_effect=RuntimeError('simulate error')) as moc_storage_delete_record: with pytest.raises(RuntimeError): # expect to raise await StorageHelper.delete_recursively( - testing_context, + ctx_fixture, well_record.id, 'well', [Entity.LOGSET], data_partition, @@ -150,7 +150,7 @@ async def test_delete_failure_on_parent_dont_delete_children(testing_context, @pytest.mark.asyncio async def test_delete_should_keep_delete_heterogeneous_failure( - testing_context, + ctx_fixture, authority, data_partition, entity_source, @@ -205,7 +205,7 @@ async def test_delete_should_keep_delete_heterogeneous_failure( @pytest.mark.asyncio async def test_delete_should_keep_delete_homogenous_failure( - testing_context, + ctx_fixture, authority, data_partition, entity_source, @@ -264,7 +264,7 @@ async def test_delete_should_keep_delete_homogenous_failure( reason_phrase='', content=b'', headers={})]) -async def test_delete_404_of_sub_delete_is_valid(testing_context, +async def test_delete_404_of_sub_delete_is_valid(ctx_fixture, data_partition, authority, entity_source, @@ -291,7 +291,7 @@ async def test_delete_404_of_sub_delete_is_valid(testing_context, side_effect=delete_success_only_well): # no exception raised await StorageHelper.delete_recursively( - testing_context, + ctx_fixture, well_record.id, 'well', [Entity.LOGSET], data_partition, @@ -305,7 +305,7 @@ async def test_delete_404_of_sub_delete_is_valid(testing_context, fastApiHTTPException(status_code=status.HTTP_404_NOT_FOUND), fastApiHTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR), RuntimeError()]) -async def test_delete_failure_get_record(testing_context, +async def test_delete_failure_get_record(ctx_fixture, data_partition, entity_source, well_record, @@ -313,6 +313,6 @@ async def test_delete_failure_get_record(testing_context, with StorageRecordServiceClientMock.set_throw('get_record', exception): with pytest.raises(exception.__class__): await StorageHelper.delete_recursively( - testing_context, + ctx_fixture, well_record.id, 'well', [], data_partition, None, StorageRecordServiceClientMock) -- GitLab From f0b9e5e1eddd411b2b0b92a5c5d93b947838087d Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 16:49:18 +0100 Subject: [PATCH 09/19] units.test fix unnecessary 'nope_logger_fixture' --- tests/unit/routers/ddms_v2/common_ddms_v2_test.py | 4 ++-- tests/unit/routers/ddms_v2/log_data_test.py | 4 ++-- tests/unit/routers/ddms_v2/log_ddms_v2_private_test.py | 2 +- tests/unit/routers/ddms_v3/common_ddms_v3_test.py | 2 +- tests/unit/routers/dipset/dip_ddms_v2.py | 4 ++-- tests/unit/routers/trajectory/trajectory_ddms_v2_test.py | 3 +-- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/unit/routers/ddms_v2/common_ddms_v2_test.py b/tests/unit/routers/ddms_v2/common_ddms_v2_test.py index a339f0de..98870c99 100644 --- a/tests/unit/routers/ddms_v2/common_ddms_v2_test.py +++ b/tests/unit/routers/ddms_v2/common_ddms_v2_test.py @@ -33,7 +33,7 @@ from app.routers.ddms_v2.storage_helper import StorageHelper from app.routers.search.search_wrapper import SearchWrapper from app.utils import Context from app.wdms_app import wdms_app, app_injector -from tests.unit.test_utils import create_mock_class, make_record, nope_logger_fixture +from tests.unit.test_utils import create_mock_class, make_record """ Contains unified common tests for the different kind. Mainly CRUD test cases @@ -141,7 +141,7 @@ SearchWrapperMock = create_mock_class(SearchWrapper) @pytest.fixture -def client(nope_logger_fixture): +def client(): async def bypass_authorization(): # empty method pass diff --git a/tests/unit/routers/ddms_v2/log_data_test.py b/tests/unit/routers/ddms_v2/log_data_test.py index 8c4c9a00..8a31fee9 100644 --- a/tests/unit/routers/ddms_v2/log_data_test.py +++ b/tests/unit/routers/ddms_v2/log_data_test.py @@ -14,7 +14,7 @@ import os -from tests.unit.test_utils import create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class from fastapi import HTTPException, Header from fastapi.testclient import TestClient @@ -70,7 +70,7 @@ StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) @pytest.fixture -def client(nope_logger_fixture, tmp_path): +def client(tmp_path): async def storage_service_builder(*args, **kwargs): return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmp_path), 'p1', 'c1') diff --git a/tests/unit/routers/ddms_v2/log_ddms_v2_private_test.py b/tests/unit/routers/ddms_v2/log_ddms_v2_private_test.py index 9f99adcb..fcfe3a18 100644 --- a/tests/unit/routers/ddms_v2/log_ddms_v2_private_test.py +++ b/tests/unit/routers/ddms_v2/log_ddms_v2_private_test.py @@ -34,7 +34,7 @@ from app.middleware import require_data_partition_id from app.wdms_app import wdms_app, app_injector from app.utils import Context from app.routers.record_utils import fetch_record, update_records -from tests.unit.test_utils import create_mock_class, nope_logger_fixture, ctx_fixture +from tests.unit.test_utils import create_mock_class, ctx_fixture from odes_storage.models import CreateUpdateRecordsResponse, Record diff --git a/tests/unit/routers/ddms_v3/common_ddms_v3_test.py b/tests/unit/routers/ddms_v3/common_ddms_v3_test.py index 00093d17..873466b3 100644 --- a/tests/unit/routers/ddms_v3/common_ddms_v3_test.py +++ b/tests/unit/routers/ddms_v3/common_ddms_v3_test.py @@ -74,7 +74,7 @@ SearchServiceClientMock = create_mock_class(SearchServiceClient) @pytest.fixture -def dasked_test_app_with_mocked_core_service(nope_logger_fixture, event_loop, tmp_path): +def dasked_test_app_with_mocked_core_service(event_loop, tmp_path): local_blob_storage = LocalFSBlobStorage(directory=tmp_path) diff --git a/tests/unit/routers/dipset/dip_ddms_v2.py b/tests/unit/routers/dipset/dip_ddms_v2.py index 799a60f0..fa61a69f 100644 --- a/tests/unit/routers/dipset/dip_ddms_v2.py +++ b/tests/unit/routers/dipset/dip_ddms_v2.py @@ -15,7 +15,7 @@ from app.clients import * from app.auth.auth import require_opendes_authorized_user from tests.unit.errors.error_handler_test import StorageRecordServiceBlobStorageMock -from tests.unit.test_utils import create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class from odes_storage.exceptions import UnexpectedResponse import pandas as pd @@ -27,7 +27,7 @@ tests_parameters = [ ] @pytest.fixture -def client(nope_logger_fixture): +def client(): async def bypass_authorization(): # empty method pass diff --git a/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py b/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py index 9db9d06e..686eadcc 100644 --- a/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py +++ b/tests/unit/routers/trajectory/trajectory_ddms_v2_test.py @@ -30,7 +30,6 @@ from app.middleware import require_data_partition_id from app.wdms_app import wdms_app, app_injector from app.utils import Context -from tests.unit.test_utils import nope_logger_fixture # Initialize traces exporter in app, like it is in app's startup decorator wdms_app.trace_exporter = traces.CombinedExporter(service_name='tested-ddms') @@ -76,7 +75,7 @@ prev_data = {"columns": ["col_100X"], "data": [[0], [1], [2]], 'index': [0, 1, 2 @pytest.fixture -def client(nope_logger_fixture, tmp_path): +def client(tmp_path): async def storage_service_builder(*args, **kwargs): return StorageRecordServiceBlobStorage(LocalFSBlobStorage(directory=tmp_path), 'p1', 'c1') -- GitLab From d543b13c4743f4834a54f9c7dd77bf23881cf699 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 10 Jan 2022 17:45:54 +0100 Subject: [PATCH 10/19] units.test fix unnecessary 'nope_logger_fixture' --- tests/unit/conftest.py | 4 ++-- tests/unit/middleware/client_test.py | 4 ++-- tests/unit/modules/log_recognition/log_recognition_test.py | 4 ++-- tests/unit/routers/ddms_v3/delete_ddms_v3_test.py | 2 +- tests/unit/routers/ddms_v3/trajectory_constency_test.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index a0042ad1..90975193 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -20,7 +20,7 @@ import pytest from app.conf import ConfigurationContainer from app.utils import Context, DaskClient from fastapi import Header -from tests.unit.test_utils import nope_logger_fixture + @pytest.fixture(autouse=True) def top_fixture(monkeypatch): @@ -67,7 +67,7 @@ def event_loop(): # all tests will share the same loop @pytest.fixture -def init_fixtures(nope_logger_fixture, monkeypatch, tmp_path): +def init_fixtures(monkeypatch, tmp_path): monkeypatch.setenv(name="USE_LOCALFS_BLOB_STORAGE_WITH_PATH", value=tmp_path) conf.Config = conf.ConfigurationContainer.with_load_all() yield diff --git a/tests/unit/middleware/client_test.py b/tests/unit/middleware/client_test.py index b21f2337..0156c5d3 100755 --- a/tests/unit/middleware/client_test.py +++ b/tests/unit/middleware/client_test.py @@ -4,7 +4,7 @@ from pytest_httpx import HTTPXMock, to_response from app.clients import make_storage_record_client, make_search_client -from tests.unit.test_utils import nope_logger_fixture, ctx_fixture +from tests.unit.test_utils import ctx_fixture import app.conf as conf from app.helper import traces from app.auth.auth import require_opendes_authorized_user @@ -43,7 +43,7 @@ async def test_fwd_correlation_id_to_outgoing_request_to_search(httpx_mock: HTTP @pytest.fixture() -async def wdms_app_mocked(nope_logger_fixture): +async def wdms_app_mocked(): from fastapi.testclient import TestClient from app.wdms_app import wdms_app, app_injector diff --git a/tests/unit/modules/log_recognition/log_recognition_test.py b/tests/unit/modules/log_recognition/log_recognition_test.py index 67a2b072..3b4e2f93 100644 --- a/tests/unit/modules/log_recognition/log_recognition_test.py +++ b/tests/unit/modules/log_recognition/log_recognition_test.py @@ -30,14 +30,14 @@ from app.middleware import require_data_partition_id from app.modules.log_recognition.routers.log_recognition import family_processor_manager from app.utils import Context from app.wdms_app import wdms_app, add_modules_routers, remove_modules_routers -from tests.unit.test_utils import create_mock_class, nope_logger, nope_logger_fixture +from tests.unit.test_utils import create_mock_class, nope_logger StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) SearchServiceClientMock = create_mock_class(SearchServiceClient) @pytest.fixture -def client(nope_logger_fixture): +def client(): async def bypass_authorization(): pass diff --git a/tests/unit/routers/ddms_v3/delete_ddms_v3_test.py b/tests/unit/routers/ddms_v3/delete_ddms_v3_test.py index ee63a7bb..e68b362a 100644 --- a/tests/unit/routers/ddms_v3/delete_ddms_v3_test.py +++ b/tests/unit/routers/ddms_v3/delete_ddms_v3_test.py @@ -32,7 +32,7 @@ from app.auth.auth import require_opendes_authorized_user from app.routers.delete import delete_bulk_data from app.utils import Context from app.wdms_app import wdms_app, app_injector -from tests.unit.test_utils import create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class StorageRecordServiceClientMock = mock.AsyncMock() BlobStorageMock = mock.AsyncMock() diff --git a/tests/unit/routers/ddms_v3/trajectory_constency_test.py b/tests/unit/routers/ddms_v3/trajectory_constency_test.py index 600d0355..a35f8a82 100644 --- a/tests/unit/routers/ddms_v3/trajectory_constency_test.py +++ b/tests/unit/routers/ddms_v3/trajectory_constency_test.py @@ -8,14 +8,14 @@ from app.helper import traces from app.middleware import require_data_partition_id from app.utils import Context from app.wdms_app import app_injector, wdms_app -from tests.unit.test_utils import create_mock_class, nope_logger_fixture +from tests.unit.test_utils import create_mock_class StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) SearchServiceClientMock = create_mock_class(SearchServiceClient) @pytest.fixture -def client(nope_logger_fixture): +def client(): async def bypass_authorization(): # empty method pass -- GitLab From 5ceb87fa6f16b847480c31e6eae17ce9e7d4a375 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Tue, 11 Jan 2022 08:43:26 +0100 Subject: [PATCH 11/19] units.test rollback removing pytest-mock --- NOTICE | 1 + requirements_dev.in | 1 + requirements_dev.txt | 3 +++ 3 files changed, 5 insertions(+) diff --git a/NOTICE b/NOTICE index 0b8451f1..b9d5bad8 100644 --- a/NOTICE +++ b/NOTICE @@ -275,6 +275,7 @@ The following software have components provided under the terms of this license: - pytest (from http://pytest.org) - pytest-cov (from https://github.com/pytest-dev/pytest-cov) - pytest-httpx (from https://colin-b.github.io/pytest_httpx/) +- pytest-mock (from https://github.com/pytest-dev/pytest-mock/) - python-rapidjson (from https://github.com/python-rapidjson/python-rapidjson) - python-ulid (from https://github.com/mdomke/python-ulid) - pytz (from http://pythonhosted.org/pytz) diff --git a/requirements_dev.in b/requirements_dev.in index 89146924..795d9f52 100644 --- a/requirements_dev.in +++ b/requirements_dev.in @@ -5,6 +5,7 @@ pip-tools>=6.4.0 pytest pytest-asyncio pytest-cov +pytest-mock pytest-httpx httpx numpy diff --git a/requirements_dev.txt b/requirements_dev.txt index 69471d4d..0d4b6431 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -134,6 +134,7 @@ pytest==6.2.4 # pytest-cov # pytest-dependency # pytest-httpx + # pytest-mock pytest-asyncio==0.15.1 # via -r requirements_dev.in pytest-cov==2.12.1 @@ -142,6 +143,8 @@ pytest-dependency==0.5.1 # via -r requirements_dev.in pytest-httpx==0.12.0 # via -r requirements_dev.in +pytest-mock==3.6.1 + # via -r requirements_dev.in python-dateutil==2.8.2 # via # -c requirements.txt -- GitLab From caa4b2facce468c33c4e631596d94c5a7b2a0e07 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Tue, 11 Jan 2022 08:46:47 +0100 Subject: [PATCH 12/19] tests.unit: use mock instead homemade 'NopeLogger' class --- .../unit/middleware/traces_middleware_test.py | 8 +--- .../log_recognition/log_recognition_test.py | 5 +-- .../unit/persistence/sessions_storage_test.py | 7 +-- tests/unit/test_utils.py | 45 +++---------------- 4 files changed, 13 insertions(+), 52 deletions(-) diff --git a/tests/unit/middleware/traces_middleware_test.py b/tests/unit/middleware/traces_middleware_test.py index da65e9de..b18fbc57 100644 --- a/tests/unit/middleware/traces_middleware_test.py +++ b/tests/unit/middleware/traces_middleware_test.py @@ -24,8 +24,7 @@ from starlette.routing import Router, Route, Mount from app.clients import SearchServiceClient, StorageRecordServiceClient from app.wdms_app import wdms_app, base_app, DDMS_V2_PATH, app_injector from app.utils import get_or_create_ctx - -from tests.unit.test_utils import NopeLogger +from tests.unit.test_utils import ctx_fixture # Initialize traces exporter in app with a custom one to allow validating our traces @@ -45,11 +44,6 @@ class ExporterInTest(base_exporter.Exporter): return sd -@pytest.fixture() -def ctx_fixture(): - """Create context with a real tracer in it""" - ctx = get_or_create_ctx().set_current_with_value(logger=NopeLogger()) - yield ctx @pytest.fixture diff --git a/tests/unit/modules/log_recognition/log_recognition_test.py b/tests/unit/modules/log_recognition/log_recognition_test.py index 3b4e2f93..50e9f5e9 100644 --- a/tests/unit/modules/log_recognition/log_recognition_test.py +++ b/tests/unit/modules/log_recognition/log_recognition_test.py @@ -30,7 +30,7 @@ from app.middleware import require_data_partition_id from app.modules.log_recognition.routers.log_recognition import family_processor_manager from app.utils import Context from app.wdms_app import wdms_app, add_modules_routers, remove_modules_routers -from tests.unit.test_utils import create_mock_class, nope_logger +from tests.unit.test_utils import create_mock_class StorageRecordServiceClientMock = create_mock_class(StorageRecordServiceClient) SearchServiceClientMock = create_mock_class(SearchServiceClient) @@ -370,8 +370,7 @@ def test_swagger_generation(): # Global module setup / teardown -def setup_module(): - nope_logger() +def setup_module(nope_logger_fixture): ConfigurationContainer.modules.value = "log_recognition.routers.log_recognition" add_modules_routers() diff --git a/tests/unit/persistence/sessions_storage_test.py b/tests/unit/persistence/sessions_storage_test.py index 042471e4..eff98098 100644 --- a/tests/unit/persistence/sessions_storage_test.py +++ b/tests/unit/persistence/sessions_storage_test.py @@ -30,13 +30,14 @@ from app.persistence.sessions_storage import (Session, from osdu.core.api.storage.blob_storage_local_fs import LocalFSBlobStorage from app.utils import Context -from tests.unit.test_utils import NopeLogger +from tests.unit.test_utils import ctx_fixture + + from unittest.mock import patch, PropertyMock @pytest.fixture -def sessions_storage(tmp_path): - Context(logger=NopeLogger).set_current() +def sessions_storage(ctx_fixture, tmp_path): yield SessionsStorage(LocalFSBlobStorage(directory=tmp_path)) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 2ebe412d..b20c604d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -14,11 +14,12 @@ import pytest import mock +from unittest.mock import patch import asyncio - -from opencensus.trace.span_context import SpanContext +import logging from contextlib import contextmanager +from opencensus.trace.span_context import SpanContext from odes_storage.models import Record, StorageAcl, Legal from app.model.model_utils import record_to_dict @@ -29,51 +30,17 @@ def ctx_fixture(): """ Create context with a fake tracer in it """ mock_mock = mock.MagicMock() mock_mock.span_context = SpanContext(trace_id="trace-id", span_id="span_id") - ctx = get_or_create_ctx().set_current_with_value(tracer=mock_mock, logger=NopeLogger()) + ctx = get_or_create_ctx().set_current_with_value(tracer=mock_mock, logger=mock.NonCallableMock(spec_set=logging.Logger)) yield ctx @pytest.fixture -def nope_logger_fixture(): - nope_logger() - yield - -def nope_logger(): - from app.helper import logger - logger._LOGGER = NopeLogger() - -class NopeLogger: - def __init__(self): - # empty method - pass - - def debug(*arg, **kargs): - # empty method - pass - - def info(*arg, **kargs): - # empty method - pass - - def warning(*arg, **kargs): - # empty method - pass +def nope_logger_fixture(mocker): + yield mocker.patch('app.helper.logger._LOGGER', spec_set=logging.Logger, new_callable=mock.NonCallableMock) - def error(*arg, **kargs): - # empty method - pass - def exception(*arg, **kargs): - # empty method - pass - def critical(*arg, **kargs): - # empty method - pass - def log(*arg, **kargs): - # empty method - pass def create_mock_class(cls_to_mock): cls_name = cls_to_mock.__name__ + 'AutoMock' -- GitLab From 1e00c64013127ad54a915346fdb9921047f9dbf1 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Tue, 11 Jan 2022 10:18:57 +0100 Subject: [PATCH 13/19] tests.unit: minor update requirements_dev.in --- requirements_dev.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.in b/requirements_dev.in index 795d9f52..50d69bb0 100644 --- a/requirements_dev.in +++ b/requirements_dev.in @@ -15,7 +15,7 @@ openapi-spec-validator mockito~=1.2 # Note since 3.8 includes Mock 4.0+. -mock>=4.0 +mock>=4.0 # Should be removed after migration to python >= 3.8 requests # used by starlette.TestClient for testing cryptography -- GitLab From b712d57c258c33e0310c764ae90347e8470b2426 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Tue, 11 Jan 2022 10:19:27 +0100 Subject: [PATCH 14/19] tests.unit.clients: minor remove ctx_fixture alias --- tests/unit/clients/client_factory_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/clients/client_factory_test.py b/tests/unit/clients/client_factory_test.py index ca8b31c5..0ec85bf5 100755 --- a/tests/unit/clients/client_factory_test.py +++ b/tests/unit/clients/client_factory_test.py @@ -32,11 +32,10 @@ from app.utils import get_or_create_ctx from tests.unit.test_utils import make_record from odes_storage.exceptions import ResponseHandlingException from app.conf import Config -from tests.unit.test_utils import ctx_fixture as test_context @pytest.mark.asyncio -async def test_make_storage_client(httpx_mock: HTTPXMock, test_context): +async def test_make_storage_client(httpx_mock: HTTPXMock, ctx_fixture): host = 'http://my_host:81234' async with make_storage_record_client(host) as client: assert isinstance(client, StorageRecordServiceClient) -- GitLab From 94f6153a623931f706e62bbfdfbd239b57c5cb94 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 17 Jan 2022 17:13:37 +0100 Subject: [PATCH 15/19] fix unit tests after rebasing master --- tests/unit/bulk_persistence/dask_data_ipc_test.py | 10 +++++----- .../dask_worker_write_bulk_test.py | 14 +++++++------- tests/unit/clients/client_factory_test.py | 3 ++- tests/unit/routers/chunking_test.py | 9 +++++++-- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/tests/unit/bulk_persistence/dask_data_ipc_test.py b/tests/unit/bulk_persistence/dask_data_ipc_test.py index addd1c6e..1bc499b6 100644 --- a/tests/unit/bulk_persistence/dask_data_ipc_test.py +++ b/tests/unit/bulk_persistence/dask_data_ipc_test.py @@ -3,7 +3,7 @@ from mock import AsyncMock from unittest.mock import patch, mock_open from contextlib import suppress -from tests.unit.test_utils import temp_directory, nope_logger_fixture, side_effect_raise +from tests.unit.test_utils import nope_logger_fixture, side_effect_raise from dask.distributed import Client @@ -43,8 +43,8 @@ async def test_none_data_ipc_handle_async_generator_and_bytes(in_data): @pytest.mark.asyncio @pytest.mark.parametrize("in_data", [b"123456789", data_async_gen()]) -async def test_file_data_ipc_handle_async_generator_and_bytes(nope_logger_fixture, temp_directory, in_data): - ipc_obj = DaskLocalFileDataIPC(base_folder=temp_directory) +async def test_file_data_ipc_handle_async_generator_and_bytes(nope_logger_fixture, tmp_path, in_data): + ipc_obj = DaskLocalFileDataIPC(base_folder=tmp_path) await assert_ipc_forward_equal(ipc_obj, b"123456789") @@ -111,8 +111,8 @@ async def test_file_data_ipc_write_by_chunk(nope_logger_fixture, in_data): @pytest.mark.asyncio -async def test_file_data_ipc_track_file_count_and_size(nope_logger_fixture, temp_directory): - ipc_obj = DaskLocalFileDataIPC(base_folder=temp_directory) +async def test_file_data_ipc_track_file_count_and_size(nope_logger_fixture, tmp_path): + ipc_obj = DaskLocalFileDataIPC(base_folder=tmp_path) async with ipc_obj.set(b"0123456789"): assert DaskLocalFileDataIPC.total_size_in_file == 10 diff --git a/tests/unit/bulk_persistence/dask_worker_write_bulk_test.py b/tests/unit/bulk_persistence/dask_worker_write_bulk_test.py index 5948d2f5..f0300fc4 100644 --- a/tests/unit/bulk_persistence/dask_worker_write_bulk_test.py +++ b/tests/unit/bulk_persistence/dask_worker_write_bulk_test.py @@ -17,7 +17,7 @@ from app.bulk_persistence.dask.dask_worker_write_bulk import (basic_describe, from app.bulk_persistence.dask.errors import BulkNotProcessable, BulkSaveException from app.bulk_persistence.dataframe_validators import no_validation -from tests.unit.test_utils import temp_directory + def dataframe_to_format(df, data_format: str, as_stream=False): @@ -54,7 +54,7 @@ def test_basic_describe_truncates_columns(): # so far post_data and add_chunk takes same input, validate similarly and throw same exceptions @pytest.mark.parametrize("method_to_test", [write_bulk_without_session, add_chunk_in_session]) -def test_post_bulk_not_processable_cases(method_to_test, temp_directory): +def test_post_bulk_not_processable_cases(method_to_test, tmp_path): def as_bytes_io(content): return BytesIO(content) @@ -96,7 +96,7 @@ def test_post_bulk_not_processable_cases(method_to_test, temp_directory): data = pd.DataFrame({'A': [1], 'B': [4]}).to_parquet(engine='pyarrow', index=True) with patch.object(pd.DataFrame, 'to_parquet', side_effect=lambda *args, **kwargs: 0/0): with pytest.raises(BulkSaveException): - method_to_test(data, as_bytes_io, MimeTypes.PARQUET, no_validation, temp_directory, None) + method_to_test(data, as_bytes_io, MimeTypes.PARQUET, no_validation, tmp_path, None) @pytest.mark.parametrize("content_type", [ @@ -122,13 +122,13 @@ def test_write_bulk_without_session_success(content_type): MimeTypes.PARQUET, MimeTypes.JSON ]) -def test_write_chunk_in_session_success(content_type, temp_directory): +def test_write_chunk_in_session_success(content_type, tmp_path): # GIVEN df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}) data = dataframe_to_format(df, content_type.type, True) # WHEN - result = add_chunk_in_session(data, lambda x: x, content_type, no_validation, temp_directory, None) + result = add_chunk_in_session(data, lambda x: x, content_type, no_validation, tmp_path, None) # THEN output basic describe matches assert result == DataframeBasicDescribe( @@ -141,13 +141,13 @@ def test_write_chunk_in_session_success(content_type, temp_directory): ) # and THEN meta file produced as a valid json - meta_files = [f for f in glob(temp_directory + '/*.meta')] + meta_files = [f for f in tmp_path.glob('*.meta')] assert len(meta_files) == 1 with open(meta_files[0]) as f: json.load(f) # and THEN dataframe saved as parquet format - parquet_files = [f for f in glob(temp_directory + '/*.parquet')] + parquet_files = [f for f in tmp_path.glob('*.parquet')] assert len(parquet_files) == 1 loaded_df = pd.read_parquet(parquet_files[0]) df.index.name = WDMS_INDEX_NAME diff --git a/tests/unit/clients/client_factory_test.py b/tests/unit/clients/client_factory_test.py index 0ec85bf5..ac21c382 100755 --- a/tests/unit/clients/client_factory_test.py +++ b/tests/unit/clients/client_factory_test.py @@ -33,6 +33,7 @@ from tests.unit.test_utils import make_record from odes_storage.exceptions import ResponseHandlingException from app.conf import Config +from tests.unit.test_utils import ctx_fixture @pytest.mark.asyncio async def test_make_storage_client(httpx_mock: HTTPXMock, ctx_fixture): @@ -53,7 +54,7 @@ async def test_make_storage_client(httpx_mock: HTTPXMock, ctx_fixture): @pytest.mark.asyncio -async def test_make_search_client(httpx_mock: HTTPXMock, test_context): +async def test_make_search_client(httpx_mock: HTTPXMock, ctx_fixture): host = 'http://my_host:81234' async with make_search_client(host) as client: assert isinstance(client, SearchServiceClient) diff --git a/tests/unit/routers/chunking_test.py b/tests/unit/routers/chunking_test.py index 68fec59f..e8f91ac0 100644 --- a/tests/unit/routers/chunking_test.py +++ b/tests/unit/routers/chunking_test.py @@ -26,6 +26,8 @@ from pandas.testing import assert_frame_equal from tests.unit.conftest import do_nothing, set_default_partition from tests.unit.persistence.dask_blob_storage_test import generate_df +from tests.unit.test_utils import nope_logger_fixture + Definitions = { 'WellLog': { 'api_version': 'v3', @@ -122,7 +124,7 @@ def _cast_datetime_to_datetime64_ns(result_df): @pytest.fixture -def dasked_test_app(init_fixtures, event_loop, tmp_path): +def dasked_test_app(init_fixtures, event_loop, tmp_path, nope_logger_fixture): local_blob_storage = LocalFSBlobStorage(directory=tmp_path) @@ -935,7 +937,10 @@ def test_send_json_parquet_in_one_session(dasked_test_app_without_consistency_cl commit_session_response = client.patch(f'{chunking_url}/{record_id}/sessions/{session_id}', json={'state': 'commit'}) - assert_commit_session_status_code(commit_session_response) + assert commit_session_response.status_code == 200 + + get_response = client.get(f'{chunking_url}/{record_id}/data') + assert get_response.status_code == 200 @pytest.mark.parametrize("entity_type", EntityTypeParams) -- GitLab From dd38e7f95ed1bb77c74278fea542dc5ce367bd76 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 17 Jan 2022 17:43:43 +0100 Subject: [PATCH 16/19] fix unit tests after rebasing master --- tests/unit/routers/bulk_apis_dependencies_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/routers/bulk_apis_dependencies_test.py b/tests/unit/routers/bulk_apis_dependencies_test.py index f6d95858..84fc8f21 100644 --- a/tests/unit/routers/bulk_apis_dependencies_test.py +++ b/tests/unit/routers/bulk_apis_dependencies_test.py @@ -4,6 +4,7 @@ from app.routers.ddms_v2 import log_ddms_v2 from app.routers.ddms_v3 import wellbore_trajectory_ddms_v3, welllog_ddms_v3 from app.wdms_app import ALPHA_APIS_PREFIX, DDMS_V2_PATH, DDMS_V3_PATH from fastapi.testclient import TestClient +from tests.unit.test_utils import nope_logger_fixture from tests.unit.routers.chunking_test import dasked_test_app base_paths = [ -- GitLab From 56e4cb8859dc4a73862cd2d5d820b6fcf7522671 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 17 Jan 2022 17:44:11 +0100 Subject: [PATCH 17/19] generate requirements file with python 3.7 --- requirements.txt | 15 ++++++++++++++- requirements_dev.txt | 18 +++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index bb7b9f00..bfae0299 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.7 # To update, run: # # pip-compile requirements.in @@ -192,6 +192,10 @@ idna==3.2 # requests # rfc3986 # yarl +importlib-metadata==4.10.1 + # via + # click + # jsonschema isodate==0.6.0 # via msrest jinja2==3.0.3 @@ -401,9 +405,16 @@ tornado==6.1 typing-extensions==3.10.0.0 # via # aiohttp + # aioitertools + # anyio + # asgiref + # importlib-metadata # osdu-data-ecosystem-search # osdu-data-ecosystem-storage # pydantic + # structlog + # uvicorn + # yarl urllib3==1.26.6 # via # botocore @@ -418,6 +429,8 @@ yarl==1.6.3 # via aiohttp zict==2.0.0 # via distributed +zipp==3.7.0 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements_dev.txt b/requirements_dev.txt index 0d4b6431..50da5a44 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.7 # To update, run: # # pip-compile requirements_dev.in @@ -61,6 +61,13 @@ idna==3.2 # anyio # requests # rfc3986 +importlib-metadata==4.10.1 + # via + # click + # jsonschema + # pep517 + # pluggy + # pytest iniconfig==1.1.1 # via pytest isodate==0.6.0 @@ -186,12 +193,21 @@ toml==0.10.2 # pytest-cov tomli==1.2.0 # via pep517 +typing-extensions==3.10.0.0 + # via + # -c requirements.txt + # anyio + # importlib-metadata urllib3==1.26.6 # via # -c requirements.txt # requests wheel==0.36.2 # via pip-tools +zipp==3.7.0 + # via + # importlib-metadata + # pep517 # The following packages are considered to be unsafe in a requirements file: # pip -- GitLab From d9c9df86315e6c09b927246b85abeb526bf311c1 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Mon, 17 Jan 2022 18:09:14 +0100 Subject: [PATCH 18/19] update fossa --- NOTICE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NOTICE b/NOTICE index b9d5bad8..3f141ad1 100644 --- a/NOTICE +++ b/NOTICE @@ -9,7 +9,7 @@ Apache-2.0 The following software have components provided under the terms of this license: - aiobotocore (from https://github.com/aio-libs/aiobotocore) -- aiohttp (from https://github.com/aio-libs/aiohttp/) +- aiohttp (from https://github.com/aio-libs/aiohttp) - async-timeout (from https://github.com/aio-libs/async_timeout/) - boto3 (from https://github.com/boto/boto3) - botocore (from https://github.com/boto/botocore) @@ -226,9 +226,9 @@ MIT The following software have components provided under the terms of this license: - PyJWT (from http://github.com/jpadilla/pyjwt) -- PyYAML +- PyYAML (from http://pyyaml.org/wiki/PyYAML) - adal (from https://github.com/AzureAD/azure-activedirectory-library-for-python) -- aiohttp (from https://github.com/aio-libs/aiohttp/) +- aiohttp (from https://github.com/aio-libs/aiohttp) - aioitertools (from https://github.com/jreese/aioitertools) - aioredis (from https://github.com/aio-libs/aioredis) - anyio (from https://pypi.org/project/anyio/3.3.0/, https://pypi.org/project/anyio/3.4.0/) -- GitLab From a91355ca2ceda49764767cf07771fb76293d4c31 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Tue, 18 Jan 2022 09:34:44 +0100 Subject: [PATCH 19/19] generate requirements file with python 3.7 --- requirements_dev.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements_dev.txt b/requirements_dev.txt index 50da5a44..2fb67f4f 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -63,6 +63,7 @@ idna==3.2 # rfc3986 importlib-metadata==4.10.1 # via + # -c requirements.txt # click # jsonschema # pep517 @@ -206,6 +207,7 @@ wheel==0.36.2 # via pip-tools zipp==3.7.0 # via + # -c requirements.txt # importlib-metadata # pep517 -- GitLab