deepyaman commented on code in PR #29061:
URL: https://github.com/apache/flink/pull/29061#discussion_r3926232694


##########
flink-python/pyflink/util/tests/test_api_stability_decorators.py:
##########
@@ -33,13 +35,17 @@
 )
 
 
[email protected]
 def _catch_warnings():
     """
-    Returns a context manager recording every warning raised within it.
+    Records every warning raised within the block.
+
+    Used where :func:`unittest.TestCase.assertWarns` cannot express the 
assertion: that
+    nothing warned, or that something warned exactly once.
     """
-    context = warnings.catch_warnings(record=True)
-    warnings.simplefilter("always")
-    return context
+    with warnings.catch_warnings(record=True) as caught:
+        warnings.simplefilter("always")
+        yield caught

Review Comment:
   Still, instead of doing this, why can't we just us `pytest.warns`? Would 
there be some incompatibility with unittest? I assume not...



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