jh1231223 opened a new pull request, #36355:
URL: https://github.com/apache/beam/pull/36355

   Thanks for reviewing!
   
   **Context / Issue**
   - Addresses flaky behavior tracked in #35211.
   - In `PortableRunnerTest::test_assert_that`, a failing `assert_that` raised 
on a worker thread was only surfaced as a 
`PytestUnhandledThreadExceptionWarning`, so the test could pass intermittently.
   
   **What this change does**
   - Captures `threading.excepthook` during the test run.
   - Wraps `beam.Pipeline.run(...).wait_until_finish()` so that any captured 
worker-thread exception is rethrown on the main thread at the end of the run.
   - Updates `test_assert_that` to use this shim and assert the expected 
failure via `assertRaisesRegex`, turning the flaky pass into a deterministic 
failure for the negative case.
   
   **Why**
   Ensures the failure path for `assert_that` is exercised reliably and 
reported as a proper test failure, rather than a warning emitted from a 
background thread.
   
   **Verification**
   Stress run x200 (no flakes):
   ```
   for i in {1..200}; do
     echo "Run $i"
     pytest -q 
apache_beam/runners/portability/portable_runner_test.py::PortableRunnerTest::test_assert_that
 \
       -W error::pytest.PytestUnhandledThreadExceptionWarning -s --maxfail=1 || 
break
   done
   ```
   Result: `200/200` passes; no thread-exception warnings.


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

Reply via email to