Skip to content

Commit 34490d3

Browse files
sylwiaszunejkodkropachev
authored andcommitted
test_libevreactor_shutdown: Use installed wheel in subprocess
The atexit subprocess test inserted the project root at sys.path[0], which shadows the installed compiled wheel with the in-tree pure-Python source. Under cibuildwheel that source lacks the libev C extension, so the import failed and the subprocess produced no output. Append the project path instead so the installed wheel takes precedence, falling back to the source tree only when the driver is not installed. Also assert the subprocess return code and include stdout/stderr in the failure message so future subprocess import/runtime failures are easier to diagnose.
1 parent 26c201a commit 34490d3

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

tests/unit/io/test_libevreactor_shutdown.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ def test_shutdown_cleanup_works_with_fix(self):
117117
import sys
118118
import os
119119
120-
# Add the driver path
121-
sys.path.insert(0, {driver_path!r})
120+
# Add the driver path as a fallback only. Append (not insert at 0) so that an
121+
# installed build of the driver (e.g. the compiled wheel under cibuildwheel)
122+
# takes precedence over the in-tree pure-Python source, which lacks the libev
123+
# C extension and would make the import fail.
124+
sys.path.append({driver_path!r})
122125
123126
# Import and setup
124127
from cassandra.io import libevreactor
@@ -162,9 +165,18 @@ def test_shutdown_cleanup_works_with_fix(self):
162165
)
163166

164167
output = result.stdout
168+
error_output = result.stderr
165169
print("\n=== Subprocess Output ===")
166170
print(output)
167171
print("=== End Output ===\n")
172+
print("\n=== Subprocess Error Output ===")
173+
print(error_output)
174+
print("=== End Error Output ===\n")
175+
176+
self.assertEqual(
177+
result.returncode, 0,
178+
"Subprocess failed\nstdout:\n{}\nstderr:\n{}".format(output, error_output)
179+
)
168180

169181
# Verify the output shows the fix is working
170182
self.assertIn("Global loop initialized: True", output)

0 commit comments

Comments
 (0)