HyukjinKwon opened a new pull request, #893:
URL: https://github.com/apache/spark-connect-rust/pull/893

   ### What changes were proposed in this pull request?
   
   `test_the_docstrings_of_the_modules_are_pysparks` of 
`test_dropin_class_modules_offline.py` (SPARK-62085) imported every module of 
`pyspark.sql` and `pyspark.errors` in the test process, through `pkgutil` and 
`importlib` in `python/tests/_runtime_docstrings.py`. One of them is 
`pyspark.sql.connect.shell.progress`. Its `Progress.__init__(..., 
output=sys.stdout)` binds the `sys.stdout` of the moment it is imported, which 
is pytest's capture of that test.
   
   So when that file ran before `test_dropin_offline.py`, as in the sorted 
order of the files, 
`test_progress_handlers_are_called_with_the_progress_of_executions_as_pyspark` 
wrote its progress bar to the stale capture instead of its `capfd`, and failed. 
CI runs `test_dropin_offline.py` first, so CI did not see it.
   
   Now:
   - **`_runtime_docstrings.py` has the comparison of the sweep with the 
golden** (`compare`), which it runs as a script on a golden and prints as JSON.
   - **The test runs it in a child interpreter** and asserts on the result, as 
before:
     - at least 2500 docstrings are compared, and none differs;
     - the modules that do not import are those of PySpark only.
   
     So the test process imports none of the modules.
   - **The other docstring test of the file stays in-process.** That is the 
parametrized test of the docstrings that PySpark Connect copies (SPARK-62078 
and SPARK-62080). It imports 25 named modules, those of the classes of a 
session's objects and their classic modules, which the client imports in use. 
None of them is of `shell` or of the workers.
   
   ### Why are the changes needed?
   
   So that the offline suite passes in any order of its files.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Tests only.
   
   ### How was this patch tested?
   
   - **The two tests in both orders.** `pytest 
tests/test_dropin_class_modules_offline.py tests/test_dropin_offline.py -k 
'docstrings_of_the_modules_are_pysparks or 
progress_handlers_are_called_with_the_progress_of_executions_as_pyspark'`:
     - on master: 1 failed (the progress test), 1 passed;
     - with this change: 2 passed, in that order and in the reverse one.
   - **The whole offline suite in sorted file order** (`pytest 
tests/test_*_offline.py`): 5576 passed, 77 skipped.
   - **The gates:** ruff 0.14.0, the stub and dispatch generators, the guards, 
`test_type_stubs_offline.py` (14 passed, 4 skipped), and the offline suite of 
`coverage.yml`, in its order: 6810 passed, 77 skipped.
   
   ### 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]

Reply via email to