[pull] master from ray-project:master#4086
Merged
pull[bot] merged 1 commit intomiqdigital:masterfrom Apr 27, 2026
Merged
Conversation
…#62821) ## Description This PR enables `test_tracing_utils` for Windows by addressing file locking issues and cross-platform line ending discrepancies. It also ensures that tracing tests are no longer skipped on Windows. ### Key Changes * **Re-enabled Windows Tests:** Removed `pytest.mark.skipif` for the `win32` platform to allow tracing tests to run in Windows environments. * **Fixed File Handle Leak in ConsoleSpanExporter:** ConsoleSpanExporter was initialized with an inline `open()` call that was never explicitly closed, causing a `PermissionError` on Windows when attempting to delete span files after tests. Fixed by subclassing ConsoleSpanExporter with a `shutdown()` method that explicitly flushes and closes the file handle. `provider.shutdown()` is now called inside `safe_remove()` to trigger the cleanup chain before deletion. * **Improved Span Parsing:** Replaced `.split("}\n{")` with `re.split(r'}\s*\n\s*{', file_contents)` in `load_spans`. This regex-based approach correctly handles different newline sequences (`\n` vs `\r\n`) and potential whitespace variations between JSON objects, preventing decoding failures. * **Explicit Exporter Path:** Added `tracing_exporter_import_path=DEFAULT_TRACING_EXPORTER_IMPORT_PATH` across multiple test cases to ensure consistent tracing configuration. --- ## Related issues Closes #61443 --- ## Additional information * **Cleanup Refactor:** Replaced all instances of `shutil.rmtree` and `os.remove` with `safe_remove_directory` for span directory management. * **Windows Compatibility Fix:** The `load_spans` fix is critical for Windows where `ConsoleSpanExporter` may output CRLF (`\r\n`) line endings, which previously broke the manual JSON string splitting logic. --- ## Test Verification * **Platform:** Windows 11 / Windows 10 * **Command:** `pytest -v python/ray/serve/tests/test_tracing_utils.py` * **Result:** Verified that all tests in `test_tracing_utils.py` pass locally on Windows after applying these changes. <img width="1766" height="434" alt="image" src="https://github.com/user-attachments/assets/bcdbe069-1145-4f47-8d09-1b059113041a" /> --------- Signed-off-by: baohg153 <baohg.main@gmail.com> Signed-off-by: phmkhoi <phanhuynhminhkhoi@gmail.com> Signed-off-by: TriNguyen1208 <ductri0981@gmail.com> Signed-off-by: Nguyễn Đức Trí <168810923+TriNguyen1208@users.noreply.github.com> Co-authored-by: phmkhoi <phanhuynhminhkhoi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )