aglinxinyuan commented on code in PR #5246:
URL: https://github.com/apache/texera/pull/5246#discussion_r3308610821


##########
amber/src/test/python/pytexera/storage/test_large_binary_output_stream.py:
##########
@@ -215,13 +215,19 @@ def test_write_after_upload_error_raises_error(self, 
large_binary):
             mock_s3.upload_fileobj.side_effect = Exception("Upload failed")
 
             stream = LargeBinaryOutputStream(large_binary)
-            stream.write(b"test data")
+            try:
+                stream.write(b"test data")
 
-            # Wait a bit for the error to be set
-            time.sleep(0.1)
+                # Wait a bit for the error to be set
+                time.sleep(0.1)
 
-            with pytest.raises(IOError, match="Background upload failed"):
-                stream.write(b"more data")
+                with pytest.raises(IOError, match="Background upload failed"):
+                    stream.write(b"more data")
+            finally:
+                # Close inside the patch scope so finalizer-driven cleanup
+                # doesn't fire against a later test's mocks.
+                with pytest.raises(IOError):

Review Comment:
   Why do you need a `with` here?



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