HyukjinKwon opened a new pull request, #895: URL: https://github.com/apache/spark-connect-rust/pull/895
### What changes were proposed in this pull request? PySpark's `is_debugging_enabled` keeps its first answer of `spark.python.sql.dataFrameDebugging.enabled` for the interpreter, in `pyspark.errors.utils._enable_debugging_cache`. A mock server takes the default, so the first Column method of a test with an active mock session caches True, which turns on the call-site origins of the expressions for the rest of the process. #872 added the autouse fixture `_debugging_cache_of_each_test` to `python/tests/conftest.py`, which restores the cache after each test. pytest sets up module-scoped fixtures before the fixtures of each test, so a session that a module-scoped fixture makes reads the cache before the per-test fixture records it. That fixture then records True and restores True. `test_dropin_class_modules_offline.py`'s `objects` fixture is such a fixture: after it, five Column pickle tests of `test_dropin_offline.py` fail whenever the files run in that order (sorted file order, not the order of `coverage.yml`): - `test_columns_pickle_as_their_expressions_as_pyspark` - `test_pickled_sort_columns_are_sort_orders_as_pyspark` - `test_pickled_when_columns_chain_as_pyspark` - `test_window_specs_pickle_as_pyspark` - `test_pickled_deep_columns_round_trip_and_send_as_they_were` This PR adds a module-scoped autouse fixture, `_debugging_cache_of_each_module`, which saves and restores the cache around each module too. pytest sets up autouse fixtures before the other fixtures of the same scope, so it records the cache before any module-scoped fixture of the module runs. The origin that an unpickled Column carries when the capture is on is a separate difference, of the binding's Column pickles, which another change addresses. ### Why are the changes needed? So that no test module decides the debugging cache of the modules after it, whatever the order of the files. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? - The five tests after `test_dropin_class_modules_offline.py`'s tests (`pytest tests/test_dropin_class_modules_offline.py tests/test_dropin_offline.py -k ...`): 5 failed before, 31 of 31 passed after, in both file orders. - The offline suite of `coverage.yml`, in its order: 6810 passed, 77 skipped. - All the offline test files and `test_arrow_handoff.py` in sorted file order: 6810 passed, 77 skipped. - ruff 0.14.0, `test_ruff_excludes.py`, the guards and `test_type_stubs_offline.py`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 This pull request and its description were written by Isaac. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
