| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import gc | ||
| import itertools | ||
| import threading | ||
| import time | ||
| import traceback | ||
| import weakref | ||
| from concurrent import futures | ||
| from operator import add | ||
| Expand Down Expand Up | @@ -55,8 +57,41 @@ def test_map_exception(self): | |
| i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5]) | ||
| self.assertEqual(i.__next__(), (0, 1)) | ||
| self.assertEqual(i.__next__(), (0, 1)) | ||
| with self.assertRaises(ZeroDivisionError): | ||
|
|
||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis test looks fragile to me, +1 to remove test altogether, the fix is straightforward enough
Sorry, something went wrong.
All reactions
|
||
| exception = None | ||
| try: | ||
| i.__next__() | ||
| except Exception as e: | ||
| exception = e | ||
| self.assertTrue( | ||
| isinstance(exception, ZeroDivisionError), | ||
| msg="should raise a ZeroDivisionError", | ||
| ) | ||
|
|
||
| # pause needed for free-threading builds on Ubuntu (ARM) and Windows | ||
| time.sleep(1) | ||
|
|
||
| self.assertFalse( | ||
| gc.get_referrers(exception), | ||
| msg="the exception should not have any referrers", | ||
| ) | ||
|
|
||
| self.assertFalse( | ||
| [ | ||
| (var, val) | ||
| # go through the frames of the exception's traceback | ||
| for frame, _ in traceback.walk_tb(exception.__traceback__) | ||
| # skipping the current frame | ||
| if frame is not exception.__traceback__.tb_frame | ||
| # go through the locals captured in that frame | ||
| for var, val in frame.f_locals.items() | ||
| # check if one of them is an exception | ||
| if isinstance(val, Exception) | ||
| # check if it is captured in its own traceback | ||
| and frame is val.__traceback__.tb_frame | ||
| ], | ||
| msg=f"the exception's traceback should not contain an exception captured in its own traceback", | ||
| ) | ||
|
|
||
| @support.requires_resource('walltime') | ||
| def test_map_timeout(self): | ||
| Expand Down Expand Up | @@ -140,7 +175,7 @@ def test_map_buffersize_when_buffer_is_full(self): | |
| self.assertEqual( | ||
| next(ints), | ||
| buffersize, | ||
| msg="should have fetched only `buffersize` elements from `ints`.", | ||
| msg="should have fetched only `buffersize` elements from `ints`", | ||
| ) | ||
|
|
||
| def test_shutdown_race_issue12456(self): | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.