Skip to content

Commit

Permalink
Renamed fixture back to bucketfs_location
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Oct 2, 2024
1 parent 6041c2d commit f295880
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
8 changes: 4 additions & 4 deletions tests/unit_tests/query_handler/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit f295880

Please sign in to comment.