leeeating opened a new pull request, #59354:
URL: https://github.com/apache/spark/pull/59354

   ### What changes were proposed in this pull request?
   
   This PR adds `python/pyspark/sql/tests/pandas/test_utils.py`, which 
unit-tests the three minimum version checks in `pyspark.sql.pandas.utils`:
   
   - `require_minimum_pandas_version`: not installed, installed without 
`__version__` (e.g. only pandas-stubs left behind), too old, supported 
(including the exact minimum), and the `FutureWarning` for pandas >= 3.0.0.
   - `require_minimum_pyarrow_version`: not installed, too old, supported, and 
`ARROW_PRE_0_15_IPC_FORMAT` set to `1` / `0`.
   - `require_minimum_numpy_version`: not installed, too old, and supported.
   
   The tests replace the packages with fake modules via 
`mock.patch.dict(sys.modules, ...)`, so they do not depend on the locally 
installed versions and do not need a JVM. Mocking `sys.modules` is needed 
because the "not installed" and "too old" paths cannot be reached in a normal 
test environment, where these packages are always installed at supported 
versions; `patch.dict` restores the real modules when each test exits, so other 
tests are not affected. The new module is registered in 
`dev/sparktestsupport/modules.py` under `pyspark_sql`.
   
   ### Why are the changes needed?
   
   These functions had no direct unit tests. Their error paths are what users 
hit when their environment is misconfigured, so a regression there would show 
up as a confusing error instead of a clear "please install/upgrade X" message.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only.
   
   ### How was this patch tested?
   
   ```
   cd python
   python -m pytest pyspark/sql/tests/pandas/test_utils.py -v
   # 13 passed, 8 subtests passed
   ```
   
   Also ran `./dev/lint-python`, which passed.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code 2.1.296 (Claude Opus 5.5)
   
   The tests and the PR text were drafted with the tool; the author chose the 
scope.
   


-- 
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]

Reply via email to