From f295880499e731f6d7e61fa85f4ceb5db441fba4 Mon Sep 17 00:00:00 2001 From: ckunki Date: Wed, 2 Oct 2024 10:52:35 +0200 Subject: [PATCH] Renamed fixture back to bucketfs_location --- tests/unit_tests/query_handler/fixtures.py | 8 ++++---- .../test_scope_query_handler_context.py | 4 ++-- .../test_top_level_query_handler_context.py | 18 ++++++------------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/unit_tests/query_handler/fixtures.py b/tests/unit_tests/query_handler/fixtures.py index 78e02ed..91c21cb 100644 --- a/tests/unit_tests/query_handler/fixtures.py +++ b/tests/unit_tests/query_handler/fixtures.py @@ -62,7 +62,7 @@ def sample_mounted_bucket(tmp_path): @pytest.fixture -def bucketfs_location_2(sample_mounted_bucket): +def bucketfs_location(sample_mounted_bucket): return bfs.path.BucketPath("a/b", sample_mounted_bucket) @@ -74,13 +74,13 @@ def mocked_temporary_bucketfs_location(tmp_path): @pytest.fixture def top_level_query_handler_context( - # bucketfs_location: BucketFSLocation, - bucketfs_location_2: bfs.path.PathLike, + # bucketfs_location_2: bfs.path.PathLike, + bucketfs_location: bfs.path.PathLike, prefix: str, schema: str, test_connection_lookup: ConnectionLookup) -> TopLevelQueryHandlerContext: query_handler_context = TopLevelQueryHandlerContext( - temporary_bucketfs_location=bucketfs_location_2, + temporary_bucketfs_location=bucketfs_location, temporary_db_object_name_prefix=prefix, connection_lookup=test_connection_lookup, temporary_schema_name=schema diff --git a/tests/unit_tests/query_handler/test_scope_query_handler_context.py b/tests/unit_tests/query_handler/test_scope_query_handler_context.py index ea8c9b1..dd226b6 100644 --- a/tests/unit_tests/query_handler/test_scope_query_handler_context.py +++ b/tests/unit_tests/query_handler/test_scope_query_handler_context.py @@ -38,11 +38,11 @@ def test_temporary_view_temporary_schema(scope_query_handler_context: ScopeQuery assert proxy.schema_name.name == schema -def test_temporary_bucketfs_file_prefix_in_name(bucketfs_location_2: bfs.path.PathLike, +def test_temporary_bucketfs_file_prefix_in_name(bucketfs_location: bfs.path.PathLike, scope_query_handler_context: ScopeQueryHandlerContext): proxy = scope_query_handler_context.get_temporary_bucketfs_location() actual_path = proxy.bucketfs_location().as_udf_path() - expected_prefix_path = bucketfs_location_2.as_udf_path() + expected_prefix_path = bucketfs_location.as_udf_path() assert actual_path.startswith(expected_prefix_path) diff --git a/tests/unit_tests/query_handler/test_top_level_query_handler_context.py b/tests/unit_tests/query_handler/test_top_level_query_handler_context.py index 6314112..eb98115 100644 --- a/tests/unit_tests/query_handler/test_top_level_query_handler_context.py +++ b/tests/unit_tests/query_handler/test_top_level_query_handler_context.py @@ -30,29 +30,25 @@ def test_cleanup_released_temporary_view_proxies( def test_cleanup_released_bucketfs_object_with_uploaded_file_proxies( top_level_query_handler_context: TopLevelQueryHandlerContext, - bucketfs_location_2: bfs.path.PathLike, - prefix: str): + bucketfs_location: bfs.path.PathLike): proxy = top_level_query_handler_context.get_temporary_bucketfs_location() # create dummy file with string content (proxy.bucketfs_location() / "test_file.txt").write("test".encode("utf-8")) top_level_query_handler_context.release() top_level_query_handler_context.cleanup_released_object_proxies() - assert not bucketfs_location_2.is_dir() + assert not bucketfs_location.is_dir() def test_cleanup_released_bucketfs_object_without_uploaded_file_proxies_after_release( - top_level_query_handler_context: TopLevelQueryHandlerContext, - bucketfs_location_2: bfs.path.PathLike, - prefix: str): + top_level_query_handler_context: TopLevelQueryHandlerContext): _ = top_level_query_handler_context.get_temporary_bucketfs_location() top_level_query_handler_context.release() top_level_query_handler_context.cleanup_released_object_proxies() +# bucketfs_location_2 def test_cleanup_release_in_reverse_order_at_top_level( - top_level_query_handler_context: TopLevelQueryHandlerContext, - bucketfs_location_2: bfs.path.PathLike, - prefix: str): + top_level_query_handler_context: TopLevelQueryHandlerContext): proxies = [top_level_query_handler_context.get_temporary_table_name() for _ in range(10)] table_names = [proxy.fully_qualified for proxy in proxies] top_level_query_handler_context.release() @@ -64,9 +60,7 @@ def test_cleanup_release_in_reverse_order_at_top_level( def test_cleanup_release_in_reverse_order_at_child( - top_level_query_handler_context: TopLevelQueryHandlerContext, - bucketfs_location_2: bfs.path.PathLike, - prefix: str): + top_level_query_handler_context: TopLevelQueryHandlerContext): parent_proxies = [top_level_query_handler_context.get_temporary_table_name() for _ in range(10)] child = top_level_query_handler_context.get_child_query_handler_context()