From 954a5858382253abd336a4e806f8dc586445ba83 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 13 Dec 2024 10:59:14 -0800 Subject: [PATCH] Catch runtime error in iterator tests Summary: This is causing errors to be displayed in the test output. Reviewed By: alexmalyshev Differential Revision: D67205100 fbshipit-source-id: 2764562e16d0b124a826e2f80f5a2305e2434595 --- test_concurrent.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test_concurrent.py b/test_concurrent.py index e3907bf..0781635 100644 --- a/test_concurrent.py +++ b/test_concurrent.py @@ -766,7 +766,13 @@ def test_iterator_failure(self): iterator._dict = BreakingDict() def worker(): - iterator.insert(0, None) + try: + iterator.insert(0, None) + except RuntimeError: + # We want the insert to fail and set the internal flag to + # indicate that a failure occurred. We don't want the error to + # propagate further than this. + pass t = threading.Thread(target=worker) t.start()