From 83d28fbe8793efad2db2d020f8f53b6b51667614 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 19 Nov 2024 13:56:52 +0100 Subject: [PATCH 1/3] dont import paginationiterator in tests --- clients/python/test/e2e/test_files_api.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clients/python/test/e2e/test_files_api.py b/clients/python/test/e2e/test_files_api.py index f56b26e1..aa103621 100644 --- a/clients/python/test/e2e/test_files_api.py +++ b/clients/python/test/e2e/test_files_api.py @@ -8,7 +8,6 @@ from pathlib import Path import osparc -from osparc._utils import PaginationIterable import pytest from memory_profiler import memory_usage from typing import Final, Callable @@ -90,9 +89,7 @@ def test_search_files( use_id: bool, faker: Faker, ) -> None: - results: PaginationIterable = files_api._search_files( - sha256_checksum=f"{faker.sha256()}" - ) + results = files_api._search_files(sha256_checksum=f"{faker.sha256()}") assert len(results) == 0, "Found file which shouldn't be there" results = files_api._search_files( From 4d9ba3a074cadfb41639c98c0e02e68765283d21 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 19 Nov 2024 14:48:00 +0100 Subject: [PATCH 2/3] dont fail when cleaning up --- clients/python/test/e2e/conftest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clients/python/test/e2e/conftest.py b/clients/python/test/e2e/conftest.py index c01cfcbd..17fc1cab 100644 --- a/clients/python/test/e2e/conftest.py +++ b/clients/python/test/e2e/conftest.py @@ -172,7 +172,10 @@ def large_server_file( upload_ram_usage=max(ram_statistics) - min(ram_statistics), ) - files_api.delete_file(uploaded_file.id) + try: + files_api.delete_file(uploaded_file.id) + except osparc.ApiException: + pass @pytest.fixture @@ -206,4 +209,7 @@ def file_with_number( server_file = files_api.upload_file(file) yield server_file - files_api.delete_file(server_file.id) + try: + files_api.delete_file(server_file.id) + except osparc.ApiException: + pass From 47a270fda8311c8565704423d4a992c49bafe17a Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 19 Nov 2024 15:19:02 +0100 Subject: [PATCH 3/3] log when error happens in cleanup @pcrespov --- clients/python/test/e2e/conftest.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/clients/python/test/e2e/conftest.py b/clients/python/test/e2e/conftest.py index 17fc1cab..e919083a 100644 --- a/clients/python/test/e2e/conftest.py +++ b/clients/python/test/e2e/conftest.py @@ -30,6 +30,8 @@ _MB: ByteSize = ByteSize(_KB * 1024) # in bytes _GB: ByteSize = ByteSize(_MB * 1024) # in bytes +_logger = logging.getLogger(__name__) + # Dictionary to store start times of tests _test_start_times = {} @@ -175,7 +177,10 @@ def large_server_file( try: files_api.delete_file(uploaded_file.id) except osparc.ApiException: - pass + _logger.warning( + f"Could not delete file on server in {file_with_number.__name__}", + exc_info=True, + ) @pytest.fixture @@ -212,4 +217,7 @@ def file_with_number( try: files_api.delete_file(server_file.id) except osparc.ApiException: - pass + _logger.warning( + f"Could not delete file on server in {file_with_number.__name__}", + exc_info=True, + )