Skip to content

Commit

Permalink
Start a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton authored and ion-elgreco committed Aug 12, 2024
1 parent 442a1a7 commit 28982f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/tests/test_table_read.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from itertools import product
import os
from datetime import date, datetime, timezone
from pathlib import Path
Expand All @@ -24,6 +25,8 @@
from pyarrow.dataset import ParquetReadOptions
from pyarrow.fs import LocalFileSystem, SubTreeFileSystem

import multiprocessing
import threading
from deltalake import DeltaTable


Expand Down Expand Up @@ -56,6 +59,23 @@ def test_read_simple_table_to_dict():
dt = DeltaTable(table_path)
assert dt.to_pyarrow_dataset().to_table().to_pydict() == {"id": [5, 7, 9]}

def recursively_read_simple_table(thread_or_process_class, depth):
print(thread_or_process_class, depth)
test_read_simple_table_to_dict()
if depth == 0:
return

process_or_thread = thread_or_process_class(target=recursively_read_simple_table, args=(thread_or_process_class, depth - 1))
process_or_thread.start()
process_or_thread.join()


@pytest.mark.parametrize("thread_or_process_class, multiprocessing_start_method", [(threading.Thread, None), (multiprocessing.Process, "forkserver"), (multiprocessing.Process, "spawn"), (multiprocessing.Process, "fork")])
def test_read_simple_in_threads_and_processes(thread_or_process_class, multiprocessing_start_method):
if multiprocessing_start_method is not None:
multiprocessing.set_start_method(multiprocessing_start_method, force=True)
recursively_read_simple_table(thread_or_process_class=thread_or_process_class, depth=10)


def test_read_simple_table_by_version_to_dict():
table_path = "../crates/test/tests/data/delta-0.2.0"
Expand Down

0 comments on commit 28982f8

Please sign in to comment.