WeichenXu123 commented on a change in pull request #24898:
[SPARK-22340][PYTHON] Add a mode to pin Python thread into JVM's
URL: https://github.com/apache/spark/pull/24898#discussion_r338057539
##########
File path: python/pyspark/ml/tests/test_wrapper.py
##########
@@ -50,19 +51,27 @@ def test_java_object_gets_detached(self):
model.__del__()
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- model._java_obj.toString()
- self.assertIn("LinearRegressionTrainingSummary",
summary._java_obj.toString())
+ def condition():
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ model._java_obj.toString()
+ self.assertIn("LinearRegressionTrainingSummary",
summary._java_obj.toString())
+ return True
+
+ eventually(condition, timeout=10, catch_assertions=True)
try:
summary.__del__()
except:
pass
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- model._java_obj.toString()
- with self.assertRaisesRegexp(py4j.protocol.Py4JError, error_no_object):
- summary._java_obj.toString()
+ def condition():
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ model._java_obj.toString()
+ with self.assertRaisesRegexp(py4j.protocol.Py4JError,
error_no_object):
+ summary._java_obj.toString()
+ return True
+
+ eventually(condition, timeout=10, catch_assertions=True)
Review comment:
So the old test here is flaky because of without sleep for a while and then
test ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]