This is an automated email from the ASF dual-hosted git repository.

uros-b pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new 89959b737570 [SPARK-58602][PYTHON][TEST][FOLLOWUP] Fix the test entry 
point of test_pyarrow_array_from_pandas_default
89959b737570 is described below

commit 89959b737570c30017432c5a577795ac15133831
Author: Spenser Sun <[email protected]>
AuthorDate: Sat Aug 8 11:07:14 2026 +0000

    [SPARK-58602][PYTHON][TEST][FOLLOWUP] Fix the test entry point of 
test_pyarrow_array_from_pandas_default
    
    ### What changes were proposed in this pull request?
    
    Change the `__main__` entry point of 
`test_pyarrow_array_from_pandas_default.py` from `main(globals()["__file__"])` 
to a bare `main()`.
    
    ### Why are the changes needed?
    
    `pyspark.testing.main(module=None)` expects either no argument (it then 
resolves the real module name via `__spec__`) or a module name -- it forwards 
its argument straight to `unittest.main(module=...)`. Passing 
`globals()["__file__"]` hands it a filesystem path, which `unittest` tries to 
import as a module name and fails:
    
    ```
    ModuleNotFoundError: No module named 
'/__w/spark/spark/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default'
    ```
    
    This aborts the `pyspark-sql` test module on master (exit code 19) before 
the rest of the shard completes, so it is currently failing CI on master and on 
open PRs. Every other pyspark test file uses a bare `main()`; this was the only 
one passing a path.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. Test-only fix.
    
    ### How was this patch tested?
    
    Ran the module both ways locally. Before, `python -m 
pyspark.tests.upstream.pyarrow.test_pyarrow_array_from_pandas_default` raised 
`ModuleNotFoundError`; after, it runs to completion (`Ran 1 test ... OK`). 
`dev/lint-python --ruff` is clean.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Opus 4.8)
    
    Closes #57864 from Spenserrrr/from-pandas-main-fix.
    
    Authored-by: Spenser Sun <[email protected]>
    Signed-off-by: Uros Bojanic <[email protected]>
    (cherry picked from commit e2f176edd3be6132a649924c48f9075c9a0f9f0d)
    Signed-off-by: Uros Bojanic <[email protected]>
---
 .../tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default.py    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default.py
 
b/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default.py
index be0e518f416a..56122eabf513 100644
--- 
a/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default.py
+++ 
b/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_from_pandas_default.py
@@ -410,4 +410,4 @@ class 
PyArrowArrayFromPandasDefaultTests(GoldenFileTestMixin, unittest.TestCase)
 if __name__ == "__main__":
     from pyspark.testing import main
 
-    main(globals()["__file__"])
+    main()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to