Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions tests/test_delta_lake.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,8 @@
import subprocess
import chdb
from chdb import session
from utils import is_musl_linux

def is_musl_linux():
"""Check if running on musl Linux"""
if platform.system() != "Linux":
return False
try:
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
print(f"stdout: {result.stdout.lower()}")
print(f"stderr: {result.stderr.lower()}")
# Check both stdout and stderr for musl
output_text = (result.stdout + result.stderr).lower()
return 'musl' in output_text
except Exception as e:
print(f"Exception in is_musl_linux: {e}")
return False

@unittest.skipUnless(sys.platform.startswith("linux") and not is_musl_linux(), "Runs only on Linux platforms")
class TestDeltaLake(unittest.TestCase):
Expand All @@ -44,5 +31,6 @@ def test_delta_lake(self):
''')
self.assertEqual(ret.rows_read(), 0)


if __name__ == "__main__":
unittest.main()
5 changes: 4 additions & 1 deletion tests/test_issue60.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import time
import unittest
import chdb
from utils import is_musl_linux


data = """url('https://datasets-documentation.s3.eu-west-3.amazonaws.com/house_parquet/house_0.parquet')"""
# data = """file('/home/Clickhouse/server/chdb-server/house_0.parquet', Parquet)"""

query_str = f'''
SELECT
Expand Down Expand Up @@ -54,11 +55,13 @@ def print_chdb(threadName, delay):


class TestQueryInThread(unittest.TestCase):
@unittest.skipIf(is_musl_linux(), "Skipping test on musl Linux")
def test_query_in_thread(self):
thread1 = myThread(1, "Thread-1", 1)
thread1.start()
thread1.join()
self.assertEqual(str(result), expected_result)


if __name__ == '__main__':
unittest.main()
16 changes: 1 addition & 15 deletions tests/test_session_concurrency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,12 @@
import platform
import subprocess
from chdb import session
from utils import is_musl_linux


test_concurrent_dir = ".tmp_test_session_concurrency"


def is_musl_linux():
if platform.system() != "Linux":
return False
try:
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
print(f"stdout: {result.stdout.lower()}")
print(f"stderr: {result.stderr.lower()}")
# Check both stdout and stderr for musl
output_text = (result.stdout + result.stderr).lower()
return 'musl' in output_text
except Exception as e:
print(f"Exception in is_musl_linux: {e}")
return False


class TestSessionConcurrency(unittest.TestCase):
def setUp(self) -> None:
shutil.rmtree(test_concurrent_dir, ignore_errors=True)
Expand Down
17 changes: 1 addition & 16 deletions tests/test_unsupported_arrow_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,7 @@
import pyarrow.compute as pc
import chdb
from chdb import ChdbError


def is_musl_linux():
"""Check if running on musl Linux"""
if platform.system() != "Linux":
return False
try:
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
print(f"stdout: {result.stdout.lower()}")
print(f"stderr: {result.stderr.lower()}")
# Check both stdout and stderr for musl
output_text = (result.stdout + result.stderr).lower()
return 'musl' in output_text
except Exception as e:
print(f"Exception in is_musl_linux: {e}")
return False
from utils import is_musl_linux


class TestUnsupportedArrowTypes(unittest.TestCase):
Expand Down
23 changes: 19 additions & 4 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import re
import os
import platform
import subprocess

current_dir = os.path.dirname(os.path.abspath(__file__))
data_file = os.path.join(
current_dir, "../tests/data/alltypes_dictionary.parquet")
data_file = os.path.join(current_dir, "../tests/data/alltypes_dictionary.parquet")

# reset elapsed time to 0.0 from output, since it will be different each time
# eg: "elapsed": 0.001015,


def reset_elapsed(input):
try:
if not isinstance(input, str):
Expand All @@ -20,3 +19,19 @@ def reset_elapsed(input):
except UnicodeDecodeError:
pass
return input


def is_musl_linux():
"""Check if running on musl Linux"""
if platform.system() != "Linux":
return False
try:
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
print(f"stdout: {result.stdout.lower()}")
print(f"stderr: {result.stderr.lower()}")
# Check both stdout and stderr for musl
output_text = (result.stdout + result.stderr).lower()
return 'musl' in output_text
except Exception as e:
print(f"Exception in is_musl_linux: {e}")
return False