Skip to content

Commit c9103f8

Browse files
authored
Merge pull request #438 from wudidapaopao/skip_unstable_network_url_query_tests
Skip unstable network url query tests on musl Linux
2 parents f81549c + 8144f63 commit c9103f8

File tree

5 files changed

+27
-50
lines changed

5 files changed

+27
-50
lines changed

tests/test_delta_lake.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,8 @@
66
import subprocess
77
import chdb
88
from chdb import session
9+
from utils import is_musl_linux
910

10-
def is_musl_linux():
11-
"""Check if running on musl Linux"""
12-
if platform.system() != "Linux":
13-
return False
14-
try:
15-
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
16-
print(f"stdout: {result.stdout.lower()}")
17-
print(f"stderr: {result.stderr.lower()}")
18-
# Check both stdout and stderr for musl
19-
output_text = (result.stdout + result.stderr).lower()
20-
return 'musl' in output_text
21-
except Exception as e:
22-
print(f"Exception in is_musl_linux: {e}")
23-
return False
2411

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

34+
4735
if __name__ == "__main__":
4836
unittest.main()

tests/test_issue60.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import time
33
import unittest
44
import chdb
5+
from utils import is_musl_linux
6+
57

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

910
query_str = f'''
1011
SELECT
@@ -54,11 +55,13 @@ def print_chdb(threadName, delay):
5455

5556

5657
class TestQueryInThread(unittest.TestCase):
58+
@unittest.skipIf(is_musl_linux(), "Skipping test on musl Linux")
5759
def test_query_in_thread(self):
5860
thread1 = myThread(1, "Thread-1", 1)
5961
thread1.start()
6062
thread1.join()
6163
self.assertEqual(str(result), expected_result)
6264

65+
6366
if __name__ == '__main__':
6467
unittest.main()

tests/test_session_concurrency.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,12 @@
77
import platform
88
import subprocess
99
from chdb import session
10+
from utils import is_musl_linux
1011

1112

1213
test_concurrent_dir = ".tmp_test_session_concurrency"
1314

1415

15-
def is_musl_linux():
16-
if platform.system() != "Linux":
17-
return False
18-
try:
19-
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
20-
print(f"stdout: {result.stdout.lower()}")
21-
print(f"stderr: {result.stderr.lower()}")
22-
# Check both stdout and stderr for musl
23-
output_text = (result.stdout + result.stderr).lower()
24-
return 'musl' in output_text
25-
except Exception as e:
26-
print(f"Exception in is_musl_linux: {e}")
27-
return False
28-
29-
3016
class TestSessionConcurrency(unittest.TestCase):
3117
def setUp(self) -> None:
3218
shutil.rmtree(test_concurrent_dir, ignore_errors=True)

tests/test_unsupported_arrow_types.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,7 @@
77
import pyarrow.compute as pc
88
import chdb
99
from chdb import ChdbError
10-
11-
12-
def is_musl_linux():
13-
"""Check if running on musl Linux"""
14-
if platform.system() != "Linux":
15-
return False
16-
try:
17-
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
18-
print(f"stdout: {result.stdout.lower()}")
19-
print(f"stderr: {result.stderr.lower()}")
20-
# Check both stdout and stderr for musl
21-
output_text = (result.stdout + result.stderr).lower()
22-
return 'musl' in output_text
23-
except Exception as e:
24-
print(f"Exception in is_musl_linux: {e}")
25-
return False
10+
from utils import is_musl_linux
2611

2712

2813
class TestUnsupportedArrowTypes(unittest.TestCase):

tests/utils.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import re
22
import os
3+
import platform
4+
import subprocess
35

46
current_dir = os.path.dirname(os.path.abspath(__file__))
5-
data_file = os.path.join(
6-
current_dir, "../tests/data/alltypes_dictionary.parquet")
7+
data_file = os.path.join(current_dir, "../tests/data/alltypes_dictionary.parquet")
78

89
# reset elapsed time to 0.0 from output, since it will be different each time
910
# eg: "elapsed": 0.001015,
10-
11-
1211
def reset_elapsed(input):
1312
try:
1413
if not isinstance(input, str):
@@ -20,3 +19,19 @@ def reset_elapsed(input):
2019
except UnicodeDecodeError:
2120
pass
2221
return input
22+
23+
24+
def is_musl_linux():
25+
"""Check if running on musl Linux"""
26+
if platform.system() != "Linux":
27+
return False
28+
try:
29+
result = subprocess.run(['ldd', '--version'], capture_output=True, text=True)
30+
print(f"stdout: {result.stdout.lower()}")
31+
print(f"stderr: {result.stderr.lower()}")
32+
# Check both stdout and stderr for musl
33+
output_text = (result.stdout + result.stderr).lower()
34+
return 'musl' in output_text
35+
except Exception as e:
36+
print(f"Exception in is_musl_linux: {e}")
37+
return False

0 commit comments

Comments
 (0)